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


PHP mb_strstr函数代码示例

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


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

示例1: onEndShowScripts

 function onEndShowScripts($action)
 {
     $timeline = $this->_getTimeline($action);
     // If there's not a timeline on this page,
     // just return true
     if (empty($timeline)) {
         return true;
     }
     $base = $action->selfUrl();
     if (mb_strstr($base, '?')) {
         $url = $base . '&realtime=1';
     } else {
         $url = $base . '?realtime=1';
     }
     $scripts = $this->_getScripts();
     foreach ($scripts as $script) {
         $action->script($script);
     }
     $user = common_current_user();
     if (!empty($user->id)) {
         $user_id = $user->id;
     } else {
         $user_id = 0;
     }
     if ($action->boolean('realtime')) {
         $realtimeUI = ' RealtimeUpdate.initPopupWindow();';
     } else {
         $pluginPath = common_path('plugins/Realtime/');
         $realtimeUI = ' RealtimeUpdate.initActions("' . $url . '", "' . $timeline . '", "' . $pluginPath . '");';
     }
     $script = ' $(document).ready(function() { ' . $realtimeUI . $this->_updateInitialize($timeline, $user_id) . '}); ';
     $action->inlineScript($script);
     return true;
 }
开发者ID:sukhjindersingh,项目名称:PHInest-Solutions,代码行数:34,代码来源:RealtimePlugin.php

示例2: isValid

 public function isValid($value)
 {
     $this->_setValue($value);
     $valueString = (string) $value;
     $people = Ml_Model_People::getInstance();
     if (mb_strstr($value, "@")) {
         $getUserByEmail = $people->getByEmail($value);
         if (empty($getUserByEmail)) {
             $this->_error(self::MSG_EMAIL_NOT_FOUND);
             return false;
         }
         Zend_Registry::getInstance()->set("loginUserInfo", $getUserByEmail);
         return true;
     }
     if (mb_strlen($value) == 0) {
         return false;
     }
     if (mb_strlen($value) > 20) {
         $this->_error(self::MSG_USERNAME_NOT_FOUND);
         return false;
     }
     if (preg_match('#([^a-z0-9_-]+)#is', $value) || $value == '0') {
         $this->_error(self::MSG_USERNAME_NOT_FOUND);
         return false;
     }
     $getUserByUsername = $people->getByUsername($value);
     if (empty($getUserByUsername)) {
         $this->_error(self::MSG_USERNAME_NOT_FOUND);
         return false;
     }
     Zend_Registry::getInstance()->set("loginUserInfo", $getUserByUsername);
     return true;
 }
开发者ID:henvic,项目名称:MediaLab,代码行数:33,代码来源:Username.php

示例3: detectContext

 private static function detectContext()
 {
     if (self::$context !== null) {
         return;
     }
     if (defined('OW_USE_CONTEXT')) {
         switch (true) {
             case OW_USE_CONTEXT == 1:
                 self::$context = self::CONTEXT_DESKTOP;
                 return;
             case OW_USE_CONTEXT == 1 << 1:
                 self::$context = self::CONTEXT_MOBILE;
                 return;
             case OW_USE_CONTEXT == 1 << 2:
                 self::$context = self::CONTEXT_API;
                 return;
         }
     }
     $context = self::CONTEXT_DESKTOP;
     try {
         $isSmart = UTIL_Browser::isSmartphone();
     } catch (Exception $e) {
         return;
     }
     if (defined('OW_CRON')) {
         $context = self::CONTEXT_DESKTOP;
     } else {
         if (self::getSession()->isKeySet(OW_Application::CONTEXT_NAME)) {
             $context = self::getSession()->get(OW_Application::CONTEXT_NAME);
         } else {
             if ($isSmart) {
                 $context = self::CONTEXT_MOBILE;
             }
         }
     }
     if (defined('OW_USE_CONTEXT')) {
         if ((OW_USE_CONTEXT & 1 << 1) == 0 && $context == self::CONTEXT_MOBILE) {
             $context = self::CONTEXT_DESKTOP;
         }
         if ((OW_USE_CONTEXT & 1 << 2) == 0 && $context == self::CONTEXT_API) {
             $context = self::CONTEXT_DESKTOP;
         }
     }
     if ((bool) OW::getConfig()->getValue('base', 'disable_mobile_context') && $context == self::CONTEXT_MOBILE) {
         $context = self::CONTEXT_DESKTOP;
     }
     //temp API context detection
     //TODO remake
     $uri = UTIL_Url::getRealRequestUri(OW::getRouter()->getBaseUrl(), $_SERVER['REQUEST_URI']);
     if (mb_strstr($uri, '/')) {
         if (trim(mb_substr($uri, 0, mb_strpos($uri, '/'))) == 'api') {
             $context = self::CONTEXT_API;
         }
     } else {
         if (trim($uri) == 'api') {
             $context = self::CONTEXT_API;
         }
     }
     self::$context = $context;
 }
开发者ID:hardikamutech,项目名称:hammu,代码行数:60,代码来源:ow.php

示例4: apiAction

 public function apiAction()
 {
     $registry = Zend_Registry::getInstance();
     $config = $registry->get("config");
     $request = $this->getRequest();
     //@todo improve security with whitelist approach or even better: redo the way this works
     $method = $request->getParam("method");
     if (!$method || mb_strlen($method) > 250 || mb_strstr($method, ".") || mb_strstr($method, "@") || mb_substr($method, 0, 1) != "/") {
         exit(1);
     }
     $method = mb_substr($method, 1);
     $responseFormat = $request->getParam("responseformat", "xml");
     if ($responseFormat == 'json') {
         $contentType = 'application/json';
     } else {
         $contentType = 'text/xml';
     }
     header("Content-Type: {$contentType}");
     //&method=bar is being passed, but whatever...
     $url = "http://" . $config['apihost'] . $config['apiroot'] . "/" . $method . "?" . getenv("QUERY_STRING");
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $result = curl_exec($ch);
     curl_close($ch);
     echo $result;
     exit(0);
 }
开发者ID:henvic,项目名称:MediaLab,代码行数:28,代码来源:ProxyController.php

示例5: VerifyLastCurCostDate

function VerifyLastCurCostDate($CurCostDate, $i, $Errors, $db)
{
    $sql = "SELECT confvalue FROM config WHERE confname='DefaultDateFormat'";
    $result = DB_query($sql, $db);
    $myrow = DB_fetch_array($result);
    $DateFormat = $myrow[0];
    if (mb_strstr('/', $PeriodEnd)) {
        $Date_Array = explode('/', $PeriodEnd);
    } elseif (mb_strstr('.', $PeriodEnd)) {
        $Date_Array = explode('.', $PeriodEnd);
    }
    if ($DateFormat == 'd/m/Y') {
        $Day = $DateArray[0];
        $Month = $DateArray[1];
        $Year = $DateArray[2];
    } elseif ($DateFormat == 'm/d/Y') {
        $Day = $DateArray[1];
        $Month = $DateArray[0];
        $Year = $DateArray[2];
    } elseif ($DateFormat == 'Y/m/d') {
        $Day = $DateArray[2];
        $Month = $DateArray[1];
        $Year = $DateArray[0];
    } elseif ($DateFormat == 'd.m.Y') {
        $Day = $DateArray[0];
        $Month = $DateArray[1];
        $Year = $DateArray[2];
    }
    if (!checkdate(intval($Month), intval($Day), intval($Year))) {
        $Errors[$i] = InvalidCurCostDate;
    }
    return $Errors;
}
开发者ID:strollClouds,项目名称:snkStudy,代码行数:33,代码来源:api_stock.php

示例6: 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

示例7: __invoke

 public function __invoke(Request $request, Response $response, callable $next)
 {
     $xml = file_get_contents('php://input');
     $xml = preg_replace('/[\\n\\r]/', '', $xml);
     $xml = preg_replace('/>\\s+/', '>', $xml);
     $rootBodyClass = 'DTS\\eBaySDK\\Trading\\Types\\AbstractResponseType';
     $parserBody = new XmlParser($rootBodyClass);
     $body = mb_strstr($xml, "<soapenv:Body>", false);
     $body = trim($body, "<soapenv:Body>");
     $body = mb_strstr($body, "</soapenv:Body>", true);
     $body = '<' . $body;
     /** @var AbstractResponseType $notification */
     $notification = $parserBody->parse($body);
     $notification->NotificationSignature = mb_strstr($xml, '<ebl:NotificationSignature xmlns:ebl="urn:ebay:apis:eBLBaseComponents">', false);
     $notification->NotificationSignature = trim($notification->NotificationSignature, '<ebl:NotificationSignature xmlns:ebl="urn:ebay:apis:eBLBaseComponents">');
     $notification->NotificationSignature = mb_strstr($notification->NotificationSignature, "</ebl:NotificationSignature>", true);
     $timestamp = mb_strstr($body, "<Timestamp>", false);
     $timestamp = trim($timestamp, "<Timestamp>");
     $timestamp = mb_strstr($timestamp, "</Timestamp>", true);
     if ($this->calculationSignature($timestamp) !== $notification->NotificationSignature) {
         throw new \Exception("Not Equalse signature", 403);
     }
     $item = ['add_date' => $notification->Timestamp->format("Y-m-d h:i:s"), 'soapaction' => $notification->NotificationEventName, 'data' => $body];
     $this->store->create($item);
     return $response->withStatus(200);
 }
开发者ID:victorynox,项目名称:TestR,代码行数:26,代码来源:NotificationAction.php

示例8: dealReply

 private static function dealReply($initReply)
 {
     $reply = $initReply;
     $findStr = "意见";
     $desc = "问题分析";
     if (isset($initReply) && !empty($initReply)) {
         //判断参数中,是否存在“意见”
         if (mb_strstr($initReply, $findStr, 'utf-8')) {
             if (mb_strstr($initReply, $desc, 'utf-8')) {
                 if (mb_strpos($initReply, $desc, 0, 'utf-8') != 0) {
                     $reply = "问题分析" . ":" . $initReply;
                 }
             } else {
                 $reply = $desc . ":" . $initReply;
             }
         } else {
             if (mb_strstr($initReply, "指导意见", 'utf-8')) {
                 $reply = "问题分析" . ":" . $initReply;
             } else {
                 $reply = "指导意见" . ":" . $initReply;
             }
         }
     }
     return $reply;
 }
开发者ID:VampireMe,项目名称:Common_PHP,代码行数:25,代码来源:XYImport_thread.php

示例9: strip

 /**
  * URL without a #hash/fragment.
  *
  * @since 150424 Initial release.
  *
  * @param string $url_uri_qsl Input URL, URI, or query string w/ a leading `?`.
  *
  * @return string URL without a #hash fragment.
  */
 public function strip(string $url_uri_qsl) : string
 {
     if (mb_strpos($url_uri_qsl, '#') !== false) {
         $url_uri_qsl = mb_strstr($url_uri_qsl, '#', true);
     }
     return $url_uri_qsl;
 }
开发者ID:websharks,项目名称:core,代码行数:16,代码来源:UrlFragment.php

示例10: 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

示例11: testTagDescription

 public function testTagDescription()
 {
     $this->Meta->set('description', $text = self::text(150));
     $tag = $this->Meta->tag('description');
     $this->assertTrue(mb_substr_count($tag, '<meta name="description"') === 1);
     $this->assertTrue(mb_substr_count($tag, '<meta name="twitter:description"') === 1);
     $this->assertTrue(mb_substr_count($tag, '<meta property="og:description"') === 1);
     $this->assertTrue(mb_substr_count($tag, '<description>') === 0);
     $this->assertTrue(mb_strstr($tag, $text) ? true : false);
 }
开发者ID:eusonlito,项目名称:laravel-meta,代码行数:10,代码来源:Tests.php

示例12: smarty_function_component

/**
 * Smarty component function.
 *
 * @author Sardar Madumarov <madumarov@gmail.com>
 * @package ow.ow_smarty.plugin
 * @since 1.0
 */
function smarty_function_component($params, $smarty)
{
    if (!isset($params['class']) || !mb_strstr($params['class'], '_')) {
        throw new InvalidArgumentException('Ivalid class name provided `' . $params['class'] . '`');
    }
    $class = trim($params['class']);
    unset($params['class']);
    $cmp = OW::getClassInstance($class, $params);
    return $cmp->render();
}
开发者ID:vazahat,项目名称:dudex,代码行数:17,代码来源:function.component.php

示例13: testGetLogFilesInfo

 public function testGetLogFilesInfo()
 {
     $username = 'user' . rand();
     try {
         HelperService::getLogFilesInfo($username);
     } catch (\Exception $error) {
         $encoding = $this->getKernel()->getContainer()->getParameter('string_functions_encoding');
         $this->assertTrue(mb_strstr($error->getMessage(), $username, false, $encoding) !== false);
         $this->assertEquals(0, $error->getCode());
     }
 }
开发者ID:aartua,项目名称:symfony2-webserver,代码行数:11,代码来源:HelpServiceTest.php

示例14: smarty_modifier_cut_details

function smarty_modifier_cut_details($string)
{
    $charset = \Pina\App::charset();
    if (empty($charset)) {
        $charset = 'utf-8';
    }
    if (($r = mb_strstr($string, '<hr class="pinacut" />', false, $charset)) !== false) {
        return $r;
    }
    return $string;
}
开发者ID:pinahq,项目名称:framework,代码行数:11,代码来源:modifier.cut_details.php

示例15: strip

 /**
  * Stripe query string.
  *
  * @since 150424 Initial release.
  *
  * @param string $url_uri_qsl Input URL, URI, or query string w/ a leading `?`.
  *
  * @return string Input `$url_uri_qsl` without a query string.
  */
 public function strip(string $url_uri_qsl) : string
 {
     if (!$qs_url_uri) {
         return $qs_url_uri;
         // Possible `0`.
     }
     if (mb_strpos($url_uri_qsl, '?') !== false) {
         $url_uri_qsl = mb_strstr($url_uri_qsl, '?', true);
     }
     return $url_uri_qsl;
 }
开发者ID:websharks,项目名称:core,代码行数:20,代码来源:UrlQuery.php


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