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


PHP core_text::utf8_to_entities方法代码示例

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


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

示例1: test_utf8_to_entities

 /**
  * Tests the static utf8_to_entities method.
  */
 public function test_utf8_to_entities()
 {
     $str = "Žluťoučký koníček©"&<>§«";
     $this->assertSame("Žluťoučký koníček©"&<>§«", core_text::utf8_to_entities($str));
     $this->assertSame("Žluťoučký koníček©"&<>§«", core_text::utf8_to_entities($str, true));
     $str = "Žluťoučký koníček©"&<>§«";
     $this->assertSame("&#x17d;lu&#x165;ou&#x10d;k&#xfd; kon&#xed;&#x10d;ek&#xa9;\"&<>&#xa7;&#xab;", core_text::utf8_to_entities($str, false, true));
     $this->assertSame("&#381;lu&#357;ou&#269;k&#253; kon&#237;&#269;ek&#169;\"&<>&#167;&#171;", core_text::utf8_to_entities($str, true, true));
 }
开发者ID:rushi963,项目名称:moodle,代码行数:12,代码来源:text_test.php

示例2: get_boundaryBox

 function get_boundaryBox($message)
 {
     $points = $message['points'];
     $angle = $message['angle'];
     $font = $this->parameter['path_to_fonts'] . $message['font'];
     $text = $message['text'];
     //print ('get_boundaryBox');
     //expandPre($message);
     // get font size
     $bounds = ImageTTFBBox($points, $angle, $font, "W");
     if ($angle < 0) {
         $fontHeight = abs($bounds[7] - $bounds[1]);
     } else {
         if ($angle > 0) {
             $fontHeight = abs($bounds[1] - $bounds[7]);
         } else {
             $fontHeight = abs($bounds[7] - $bounds[1]);
         }
     }
     // get boundary box and offsets for printing at an angle
     // start of Moodle addition
     $text = core_text::utf8_to_entities($text, true, true);
     //gd does not work with hex entities!
     // end of Moodle addition
     $bounds = ImageTTFBBox($points, $angle, $font, $text);
     if ($angle < 0) {
         $width = abs($bounds[4] - $bounds[0]);
         $height = abs($bounds[3] - $bounds[7]);
         $offsetY = abs($bounds[3] - $bounds[1]);
         $offsetX = 0;
     } else {
         if ($angle > 0) {
             $width = abs($bounds[2] - $bounds[6]);
             $height = abs($bounds[1] - $bounds[5]);
             $offsetY = 0;
             $offsetX = abs($bounds[0] - $bounds[6]);
         } else {
             $width = abs($bounds[4] - $bounds[6]);
             $height = abs($bounds[7] - $bounds[1]);
             $offsetY = $bounds[1];
             $offsetX = 0;
         }
     }
     //return values
     return array('width' => $width, 'height' => $height, 'offsetX' => $offsetX, 'offsetY' => $offsetY);
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:46,代码来源:graphlib.php


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