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


PHP PMF_String::strpos方法代码示例

本文整理汇总了PHP中PMF_String::strpos方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_String::strpos方法的具体用法?PHP PMF_String::strpos怎么用?PHP PMF_String::strpos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PMF_String的用法示例。


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

示例1: wrapLines

 /**
  * Wraps the lines contained into the given message.
  *
  * @param  string  $message Message.
  * @param  integer $width   Column width. Defaults to 72.
  * @param  boolean $cut     Cutting a word is allowed. Defaults to false.
  *
  * @return string The given message, wrapped as requested.
  */
 public function wrapLines($message, $width = 72, $cut = false)
 {
     $message = $this->fixEOL($message);
     if (PMF_String::strpos(strtolower($this->charset), 'utf') !== false) {
         // PHP wordwrap() is not safe with multibyte UTF chars
         return $message;
     } else {
         $lines = explode($this->eol, $message);
         $wrapped = '';
         foreach ($lines as $value) {
             $wrapped .= empty($wrapped) ? '' : $this->eol;
             $wrapped .= wordwrap($value, $width, $this->eol, $cut);
         }
         return $wrapped;
     }
 }
开发者ID:kapljr,项目名称:Jay-Kaplan-Farmingdale-BCS-Projects,代码行数:25,代码来源:Mail.php

示例2: makeAbsoluteURL

 /**
  * This function converts relative uri into absolute uri using specific reference point.
  * For example,
  *   $relativeuri = "test/foo.html"
  *   $referenceuri = "http://example.com:8000/sample/index.php"
  * will generate "http://example.com:8000/sample/test/foo.html"
  *
  * @param   string $relativeuri
  * @param   string $message
  * @return  string $result
  * @access  private
  * @author  Minoru TODA <todam@netjapan.co.jp>
  * @since   2005-08-01
  */
 function makeAbsoluteURL($relativeuri = "", $referenceuri = "")
 {
     // If relativeuri is protocol we don't want to handle, don't process it.
     foreach ($this->invalid_protocols as $_protocol => $_message) {
         if (PMF_String::strpos($relativeuri, $_protocol) === 0) {
             return $relativeuri;
         }
     }
     // If relativeuri is absolute URI, don't process it.
     foreach (array("http://", "https://") as $_protocol) {
         if (PMF_String::strpos($relativeuri, $_protocol) === 0) {
             return $relativeuri;
         }
     }
     // Split reference uri into parts.
     $pathparts = parse_url($referenceuri);
     // If port is specified in reference uri, prefix with ":"
     if (isset($pathparts['port']) && $pathparts['port'] != "") {
         $pathparts['port'] = ":" . $pathparts['port'];
     } else {
         $pathparts['port'] = "";
     }
     // If path is not specified in reference uri, set as blank
     if (isset($pathparts['path'])) {
         $pathparts['path'] = str_replace("\\", "/", $pathparts['path']);
         $pathparts['path'] = preg_replace("/^.*(\\/)\$/i", "", $pathparts['path']);
     } else {
         $pathparts['path'] = "";
     }
     // Recombine urls
     if (PMF_String::substr($relativeuri, 0, 1) == "/") {
         return $pathparts['scheme'] . "://" . $pathparts['host'] . $pathparts['port'] . $relativeuri;
     } else {
         return $pathparts['scheme'] . "://" . $pathparts['host'] . $pathparts['port'] . $pathparts['path'] . "/" . $relativeuri;
     }
 }
开发者ID:jr-ewing,项目名称:phpMyFAQ,代码行数:50,代码来源:Linkverifier.php

示例3: strpos

 /**
  * Get position of the first occurence of a string
  * 
  * @param string $haystack Haystack
  * @param string $needle   Needle
  * @param string $offset   Offset
  * 
  * @return int
  */
 public static function strpos($haystack, $needle, $offset = 0)
 {
     return self::$instance->strpos($haystack, $needle, $offset);
 }
开发者ID:noon,项目名称:phpMyFAQ,代码行数:13,代码来源:String.php

示例4: checkBannedWord

/**
 * This function checks the content against a dab word list
 * if the banned word spam protection has been activated from the general PMF configuration.
 *
 * @param   string  $content
 * @return  bool
 * @access  public
 * @author  Katherine A. Bouton
 * @author  Thorsten Rinne <thorsten@phpmyfaq.de>
 * @author  Matteo Scaramuccia <matteo@phpmyfaq.de>
 * @author  Peter Beauvain <pbeauvain@web.de>
 */
function checkBannedWord($content)
{
    // Sanity checks
    $content = trim($content);
    if ('' == $content && !PMF_Configuration::getInstance()->get('spam.checkBannedWords')) {
        return true;
    }
    $bannedWords = getBannedWords();
    // We just search a match of, at least, one banned word into $content
    $content = PMF_String::strtolower($content);
    if (is_array($bannedWords)) {
        foreach ($bannedWords as $bannedWord) {
            if (PMF_String::strpos($content, PMF_String::strtolower($bannedWord)) !== false) {
                return false;
            }
        }
    }
    return true;
}
开发者ID:atlcurling,项目名称:tkt,代码行数:31,代码来源:functions.php

示例5: isKeyASecondPluralForm

 /**
  * Check if the key is a second plural form
  *
  * @param string $key Key
  *
  * @return boolean
  */
 public function isKeyASecondPluralForm($key)
 {
     return PMF_String::strpos($key, '[1]') !== false;
 }
开发者ID:nosch,项目名称:phpMyFAQ,代码行数:11,代码来源:TransTool.php

示例6: image_two

 /**
  * Bild-Auswertung und Transformation
  *
  * Diese Funktion selektiert die Bildquelle basierend auf <img...Tag und
  * transformiert diese
  *
  * @param   string $imageString
  * @return  string $imageString
  * @author  David Sauer <david_sauer@web.de>
  * @since   2005-07-21
  */
 function image_two(&$imageString)
 {
     $img_end = PMF_String::preg_match('/\\"(\\/(.*?))\\"/', $imageString, $matches);
     $source = $matches[1];
     $this->xmlContent .= '<para>' . '<mediaobject>' . '<imageobject>' . '<imagedata fileref="http://localhost' . $source . '" />' . '</imageobject>' . '</mediaobject>' . '</para>';
     $imageString = ltrim(PMF_String::substr($imageString, PMF_String::strpos($imageString, '/>') + 2));
 }
开发者ID:noon,项目名称:phpMyFAQ,代码行数:18,代码来源:Docbook.php

示例7: decode

 /**
  * Decode a given ACE domain name
  * @param    string   Domain name (ACE string)
  * [@param    string   Desired output encoding, see {@link set_parameter}]
  * @return   string   Decoded Domain name (UTF-8 or UCS-4)
  */
 public function decode($input, $one_time_encoding = false)
 {
     // Optionally set
     if ($one_time_encoding) {
         switch ($one_time_encoding) {
             case 'utf8':
             case 'ucs4_string':
             case 'ucs4_array':
                 break;
             default:
                 $this->_error('Unknown encoding ' . $one_time_encoding);
                 return false;
         }
     }
     // Make sure to drop any newline characters around
     $input = trim($input);
     // Negotiate input and try to determine, whether it is a plain string,
     // an email address or something like a complete URL
     if (PMF_String::strpos($input, '@')) {
         // Maybe it is an email address
         // No no in strict mode
         if ($this->_strict_mode) {
             $this->_error('Only simple domain name parts can be handled in strict mode');
             return false;
         }
         list($email_pref, $input) = explode('@', $input, 2);
         $arr = explode('.', $input);
         foreach ($arr as $k => $v) {
             if (PMF_String::preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $v)) {
                 $conv = $this->_decode($v);
                 if ($conv) {
                     $arr[$k] = $conv;
                 }
             }
         }
         $input = join('.', $arr);
         $arr = explode('.', $email_pref);
         foreach ($arr as $k => $v) {
             if (PMF_String::preg_match('!^' . preg_quote($this->_punycode_prefix, '!') . '!', $v)) {
                 $conv = $this->_decode($v);
                 if ($conv) {
                     $arr[$k] = $conv;
                 }
             }
         }
         $email_pref = join('.', $arr);
         $return = $email_pref . '@' . $input;
     } elseif (PMF_String::preg_match('![:\\./]!', $input)) {
         // Or a complete domain name (with or without paths / parameters)
         // No no in strict mode
         if ($this->_strict_mode) {
             $this->_error('Only simple domain name parts can be handled in strict mode');
             return false;
         }
         $parsed = parse_url($input);
         if (isset($parsed['host'])) {
             $arr = explode('.', $parsed['host']);
             foreach ($arr as $k => $v) {
                 $conv = $this->_decode($v);
                 if ($conv) {
                     $arr[$k] = $conv;
                 }
             }
             $parsed['host'] = join('.', $arr);
             $return = (empty($parsed['scheme']) ? '' : $parsed['scheme'] . (PMF_String::strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')) . (empty($parsed['user']) ? '' : $parsed['user'] . (empty($parsed['pass']) ? '' : ':' . $parsed['pass']) . '@') . $parsed['host'] . (empty($parsed['port']) ? '' : ':' . $parsed['port']) . (empty($parsed['path']) ? '' : $parsed['path']) . (empty($parsed['query']) ? '' : '?' . $parsed['query']) . (empty($parsed['fragment']) ? '' : '#' . $parsed['fragment']);
         } else {
             // parse_url seems to have failed, try without it
             $arr = explode('.', $input);
             foreach ($arr as $k => $v) {
                 $conv = $this->_decode($v);
                 $arr[$k] = $conv ? $conv : $v;
             }
             $return = join('.', $arr);
         }
     } else {
         // Otherwise we consider it being a pure domain name string
         $return = $this->_decode($input);
         if (!$return) {
             $return = $input;
         }
     }
     // The output is UTF-8 by default, other output formats need conversion here
     // If one time encoding is given, use this, else the objects property
     switch ($one_time_encoding ? $one_time_encoding : $this->_api_encoding) {
         case 'utf8':
             return $return;
             break;
         case 'ucs4_string':
             return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return));
             break;
         case 'ucs4_array':
             return $this->_utf8_to_ucs4($return);
             break;
         default:
//.........这里部分代码省略.........
开发者ID:noon,项目名称:phpMyFAQ,代码行数:101,代码来源:idna_convert.class.php


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