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


PHP fHTML::decode方法代码示例

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


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

示例1: makeFriendly

 /**
  * Changes a string into a URL-friendly string
  * 
  * @param  string $string  The string to convert
  * @return void
  */
 public static function makeFriendly($string)
 {
     $string = fHTML::decode(fUTF8::ascii($string));
     $string = strtolower(trim($string));
     $string = str_replace("'", '', $string);
     $string = preg_replace('#[^a-z0-9\\-]+#', '_', $string);
     $string = preg_replace('#_{2,}#', '_', $string);
     $string = preg_replace('#_-_#', '-', $string);
     return preg_replace('#(^_+|_+$)#D', '', $string);
 }
开发者ID:jsuarez,项目名称:MyDesign,代码行数:16,代码来源:fURL.php

示例2: makeFriendly

 /**
  * Changes a string into a URL-friendly string
  *
  * @param  string   $string      The string to convert
  * @param  integer  $max_length  The maximum length of the friendly URL
  * @param  string   $delimiter   The delimiter to use between words, defaults to `_`
  * @param  string   |$string
  * @param  string   |$delimiter
  * @return string  The URL-friendly version of the string
  */
 public static function makeFriendly($string, $max_length = NULL, $delimiter = NULL)
 {
     // This allows omitting the max length, but including a delimiter
     if ($max_length && !is_numeric($max_length)) {
         $delimiter = $max_length;
         $max_length = NULL;
     }
     $string = fHTML::decode(fUTF8::ascii($string));
     $string = strtolower(trim($string));
     $string = str_replace("'", '', $string);
     if (!strlen($delimiter)) {
         $delimiter = '_';
     }
     $delimiter_replacement = strtr($delimiter, array('\\' => '\\\\', '$' => '\\$'));
     $delimiter_regex = preg_quote($delimiter, '#');
     $string = preg_replace('#[^a-z0-9\\-_]+#', $delimiter_replacement, $string);
     $string = preg_replace('#' . $delimiter_regex . '{2,}#', $delimiter_replacement, $string);
     $string = preg_replace('#_-_#', '-', $string);
     $string = preg_replace('#(^' . $delimiter_regex . '+|' . $delimiter_regex . '+$)#D', '', $string);
     $length = strlen($string);
     if ($max_length && $length > $max_length) {
         $last_pos = strrpos($string, $delimiter, ($length - $max_length - 1) * -1);
         if ($last_pos < ceil($max_length / 2)) {
             $last_pos = $max_length;
         }
         $string = substr($string, 0, $last_pos);
     }
     return $string;
 }
开发者ID:alandsidel,项目名称:flourish-classes,代码行数:39,代码来源:fURL.php

示例3: makeFriendly

 /**
  * Changes a string into a URL-friendly string
  * 
  * @param  string   $string      The string to convert
  * @param  interger $max_length  The maximum length of the friendly URL
  * @return string  The URL-friendly version of the string
  */
 public static function makeFriendly($string, $max_length = NULL)
 {
     $string = fHTML::decode(fUTF8::ascii($string));
     $string = strtolower(trim($string));
     $string = str_replace("'", '', $string);
     $string = preg_replace('#[^a-z0-9\\-]+#', '_', $string);
     $string = preg_replace('#_{2,}#', '_', $string);
     $string = preg_replace('#_-_#', '-', $string);
     $string = preg_replace('#(^_+|_+$)#D', '', $string);
     $length = strlen($string);
     if ($max_length && $length > $max_length) {
         $last_pos = strrpos($string, '_', ($length - $max_length - 1) * -1);
         if ($last_pos < ceil($max_length / 2)) {
             $last_pos = $max_length;
         }
         $string = substr($string, 0, $last_pos);
     }
     return $string;
 }
开发者ID:hicapacity,项目名称:safecast.org,代码行数:26,代码来源:fURL.php


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