コード例 #1
0
ファイル: ChartObject.php プロジェクト: byjg/xmlnuke
 /**
  *
  * @param string $name
  * @param ChartColumnType $type
  * @param string $data
  */
 public function addSerie($name, $type, $data)
 {
     $iter = $this->_Serie->getIterator();
     if ($iter->Count() == 0) {
         $this->_Serie->addField('data_0', "'{$name}'");
         foreach ($data as $item) {
             if ($type == ChartColumnType::String) {
                 $item = "'" . FromUTF8::removeAccent($item) . "'";
             } else {
                 if ($type == ChartColumnType::Number) {
                     $item = intval($item);
                 } else {
                     throw new UnexpectedValueException('Unexpected Chat Column Type - ' . $type);
                 }
             }
             $this->_Serie->appendRow();
             $this->_Serie->addField('data_0', $item);
         }
     } else {
         $serieCount = null;
         foreach ($iter as $row) {
             if ($serieCount == null) {
                 $serieCount = count($row->toArray());
                 $row->addField("data_{$serieCount}", "'{$name}'");
             } else {
                 if (count($data) > 0) {
                     if ($type == ChartColumnType::String) {
                         $item = "'" . array_shift($data) . "'";
                     } else {
                         if ($type == ChartColumnType::Number) {
                             $item = intval(array_shift($data));
                         } else {
                             throw new UnexpectedValueException('Unexpected Chat Column Type - ' . $type);
                         }
                     }
                     $row->addField("data_{$serieCount}", $item);
                 }
             }
         }
     }
 }
コード例 #2
0
ファイル: example.php プロジェクト: byjg/convert
<?php

require "vendor/autoload.php";
$str = \ByJG\Convert\ToUTF8::fromHtmlEntities('Jo&atilde;o');
echo $str;
// João
$str2 = \ByJG\Convert\FromUTF8::toHtmlEntities('João');
echo $str2;
// Jo&atilde;o
$str3 = \ByJG\Convert\FromUTF8::removeAccent('João');
echo $str3;
// Joao
$str4 = \ByJG\Convert\FromUTF8::toIso88591Email('João');
echo $str4;
// =?iso-8859-1?Q?Jo=E3o?=