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


PHP PMF_String::strtolower方法代码示例

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


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

示例1: strtolower

 /**
  * Make a string lower case
  * 
  * @param string $str String
  * 
  * @return string
  */
 public static function strtolower($str)
 {
     return self::$instance->strtolower($str);
 }
开发者ID:noon,项目名称:phpMyFAQ,代码行数:11,代码来源:String.php

示例2: clean

 /**
  * Filter some text cutting out all non words and stop words
  * 
  * @param string $input text to filter
  * 
  * @return string 
  */
 public function clean($input)
 {
     $words = explode(' ', ereg_replace('[[:punct:][:space:]]+', ' ', $input));
     $stop_words = $this->getByLang(null, true);
     $retval = array();
     foreach ($words as $word) {
         $word = PMF_String::strtolower($word);
         if (!is_numeric($word) && 1 < PMF_String::strlen($word) && !in_array($word, $stop_words) && !in_array($word, $retval)) {
             $retval[] = $word;
         }
     }
     return $retval;
 }
开发者ID:noon,项目名称:phpMyFAQ,代码行数:20,代码来源:Stopwords.php

示例3: checkBannedWord

 /**
  * This function checks the content against a bad word list if the banned
  * word spam protection has been activated from the general phpMyFAQ
  * configuration.
  *
  * @param string $content
  *
  * @return bool
  */
 public function checkBannedWord($content)
 {
     // Sanity checks
     $content = PMF_String::strtolower(trim($content));
     if ('' === $content || !$this->_config->get('spam.checkBannedWords')) {
         return true;
     }
     // Check if we check more than one word
     $checkWords = explode(' ', $content);
     if (1 === count($checkWords)) {
         $checkWords = array($content);
     }
     $bannedWords = $this->getBannedWords();
     // We just search a match of, at least, one banned word into $content
     if (is_array($bannedWords)) {
         foreach ($bannedWords as $bannedWord) {
             foreach ($checkWords as $word) {
                 if (PMF_String::strtolower($word) === PMF_String::strtolower($bannedWord)) {
                     return false;
                 }
             }
         }
     }
     return true;
 }
开发者ID:ae120,项目名称:phpMyFAQ,代码行数:34,代码来源:Stopwords.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: getSEOItemTitle

 /**
  * Returns a search engine optimized title
  *
  * @param string $title
  *
  * @return string
  */
 public function getSEOItemTitle($title = '')
 {
     if ('' === $title) {
         $title = $this->itemTitle;
     }
     $itemTitle = trim($title);
     // Lower the case (aesthetic)
     $itemTitle = PMF_String::strtolower($itemTitle);
     // Use '_' for some other characters for:
     // 1. avoiding regexp match break;
     // 2. improving the reading.
     $itemTitle = str_replace(array('-', "'", '/', '&#39'), '_', $itemTitle);
     // 1. Remove any CR LF sequence
     // 2. Use a '-' for the words separation
     $itemTitle = PMF_String::preg_replace('/\\s/m', '-', $itemTitle);
     // Hack: remove some chars for having a better readable title
     $itemTitle = str_replace(array('+', ',', ';', ':', '.', '?', '!', '"', '(', ')', '[', ']', '{', '}', '<', '>'), '', $itemTitle);
     // Hack: move some chars to "similar" but plain ASCII chars
     $itemTitle = str_replace(array('à', 'è', 'é', 'ì', 'ò', 'ù', 'ä', 'ö', 'ü', 'ß', 'Ä', 'Ö', 'Ü', 'č', 'ę', 'ė', 'į', 'š', 'ų', 'ū', 'ž'), array('a', 'e', 'e', 'i', 'o', 'u', 'ae', 'oe', 'ue', 'ss', 'Ae', 'Oe', 'Ue', 'c', 'e', 'e', 'i', 's', 'u', 'u', 'z'), $itemTitle);
     // Clean up
     $itemTitle = PMF_String::preg_replace('/-[\\-]+/m', '-', $itemTitle);
     return rawurlencode($itemTitle);
 }
开发者ID:ae120,项目名称:phpMyFAQ,代码行数:30,代码来源:Link.php

示例6: saveTags

 /**
  * Saves all tags from a FAQ record
  *
  * @param integer $record_id Record ID
  * @param array   $tags      Array of tags
  */
 public function saveTags($record_id, $tags)
 {
     if (!is_array($tags)) {
         return false;
     }
     $current_tags = $this->getAllTags();
     // Delete all tag references for the faq record
     if (count($tags) > 0) {
         $this->deleteTagsFromRecordId($record_id);
     }
     // Store tags and references for the faq record
     foreach ($tags as $tagging_name) {
         $tagging_name = trim($tagging_name);
         if (PMF_String::strlen($tagging_name) > 0) {
             if (!in_array(PMF_String::strtolower($tagging_name), array_map(array('PMF_String', 'strtolower'), $current_tags))) {
                 // Create the new tag
                 $new_tagging_id = $this->db->nextID(SQLPREFIX . 'faqtags', 'tagging_id');
                 $query = sprintf("\n                        INSERT INTO\n                            %sfaqtags\n                        (tagging_id, tagging_name)\n                            VALUES\n                        (%d, '%s')", SQLPREFIX, $new_tagging_id, $tagging_name);
                 $this->db->query($query);
                 // Add the tag reference for the faq record
                 $query = sprintf("\n                        INSERT INTO\n                            %sfaqdata_tags\n                        (record_id, tagging_id)\n                            VALUES\n                        (%d, %d)", SQLPREFIX, $record_id, $new_tagging_id);
                 $this->db->query($query);
             } else {
                 // Add the tag reference for the faq record
                 $query = sprintf("\n                        INSERT INTO\n                            %sfaqdata_tags\n                        (record_id, tagging_id)\n                            VALUES\n                        (%d, %d)", SQLPREFIX, $record_id, array_search(PMF_String::strtolower($tagging_name), array_map(array('PMF_String', 'strtolower'), $current_tags)));
                 $this->db->query($query);
             }
         }
     }
     return true;
 }
开发者ID:nosch,项目名称:phpMyFAQ,代码行数:37,代码来源:Tags.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::strtolower方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。