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


PHP Toolbox::decodeFromUtf8方法代码示例

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


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

示例1: decodeFromUtf8Array

function decodeFromUtf8Array(&$arg)
{
    if (is_array($arg)) {
        foreach (array_keys($arg) as $key) {
            decodeFromUtf8Array($arg[$key]);
        }
    } else {
        if (is_string($arg)) {
            $arg = Toolbox::decodeFromUtf8($arg);
        }
    }
}
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:12,代码来源:xmlrpc.php

示例2: pdfForComputer

 static function pdfForComputer(PluginPdfSimplePDF $pdf, Computer $item)
 {
     global $DB;
     $ID = $item->getField('id');
     $query = "SELECT `glpi_filesystems`.`name` AS fsname, `glpi_computerdisks`.*\n                FROM `glpi_computerdisks`\n                LEFT JOIN `glpi_filesystems`\n                  ON (`glpi_computerdisks`.`filesystems_id` = `glpi_filesystems`.`id`)\n                WHERE (`computers_id` = '" . $ID . "')";
     $result = $DB->query($query);
     $pdf->setColumnsSize(100);
     if ($DB->numrows($result) > 0) {
         $pdf->displayTitle("<b>" . _n('Volume', 'Volumes', 2) . "</b>");
         $pdf->setColumnsSize(22, 23, 22, 11, 11, 11);
         $pdf->displayTitle('<b>' . __('Name'), __('Partition'), _('Mount point'), __('Type'), __('Global size'), __('Free size') . '</b>');
         $pdf->setColumnsAlign('left', 'left', 'left', 'center', 'right', 'right');
         while ($data = $DB->fetch_assoc($result)) {
             $pdf->displayLine('<b>' . Toolbox::decodeFromUtf8(empty($data['name']) ? $data['ID'] : $data['name'], "windows-1252") . '</b>', $data['device'], $data['mountpoint'], Html::clean(Dropdown::getDropdownName('glpi_filesystems', $data["filesystems_id"])), sprintf(__('%s Mio'), Html::clean(Html::formatNumber($data['totalsize'], false, 0))), sprintf(__('%s Mio'), Html::clean(Html::formatNumber($data['freesize'], false, 0))));
         }
     } else {
         $pdf->displayTitle("<b>" . __('No volume found', 'pdf') . "</b>");
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:20,代码来源:computerdisk.class.php

示例3: showFooter

 /**
  * Print generic footer
  *
  * @param $type   display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
  * @param $title  title of file : used for PDF (default '')
  *
  * @return string to display
  **/
 static function showFooter($type, $title = "")
 {
     $out = "";
     switch ($type) {
         case self::PDF_OUTPUT_LANDSCAPE:
             //pdf
             global $PDF_HEADER, $PDF_ARRAY;
             $pdf = new Cezpdf('a4', 'landscape');
             $pdf->selectFont(GLPI_ROOT . "/lib/ezpdf/fonts/Helvetica.afm");
             $nb = count($PDF_ARRAY);
             $tmptxt = sprintf(_n('%s item', '%s items', $nb), $nb);
             $pdf->ezStartPageNumbers(750, 10, 10, 'left', "GLPI PDF export - " . Html::convDate(date("Y-m-d")) . " - " . Toolbox::decodeFromUtf8($tmptxt, 'windows-1252') . " - {PAGENUM}/{TOTALPAGENUM}");
             $options = array('fontSize' => 8, 'colGap' => 2, 'maxWidth' => 800, 'titleFontSize' => 8);
             $pdf->ezTable($PDF_ARRAY, $PDF_HEADER, Toolbox::decodeFromUtf8($title, 'windows-1252'), $options);
             $pdf->ezStream();
             break;
         case self::PDF_OUTPUT_PORTRAIT:
             //pdf
             global $PDF_HEADER, $PDF_ARRAY;
             $pdf = new Cezpdf('a4', 'portrait');
             $pdf->selectFont(GLPI_ROOT . "/lib/ezpdf/fonts/Helvetica.afm");
             $nb = count($PDF_ARRAY);
             $tmptxt = sprintf(_n('%s item', '%s items', $nb), $nb);
             $pdf->ezStartPageNumbers(550, 10, 10, 'left', "GLPI PDF export - " . Html::convDate(date("Y-m-d")) . " - " . Toolbox::decodeFromUtf8($tmptxt, 'windows-1252') . " - {PAGENUM}/{TOTALPAGENUM}");
             $options = array('fontSize' => 8, 'colGap' => 2, 'maxWidth' => 565, 'titleFontSize' => 8);
             $pdf->ezTable($PDF_ARRAY, $PDF_HEADER, Toolbox::decodeFromUtf8($title, 'windows-1252'), $options);
             $pdf->ezStream();
             break;
         case self::SYLK_OUTPUT:
             //sylk
             global $SYLK_HEADER, $SYLK_ARRAY, $SYLK_SIZE;
             // largeurs des colonnes
             foreach ($SYLK_SIZE as $num => $val) {
                 $out .= "F;W" . $num . " " . $num . " " . min(50, $val) . "\n";
             }
             $out .= "\n";
             // Header
             foreach ($SYLK_HEADER as $num => $val) {
                 $out .= "F;SDM4;FG0C;" . ($num == 1 ? "Y1;" : "") . "X{$num}\n";
                 $out .= "C;N;K\"" . self::sylk_clean($val) . "\"\n";
                 $out .= "\n";
             }
             // Datas
             foreach ($SYLK_ARRAY as $row => $tab) {
                 foreach ($tab as $num => $val) {
                     $out .= "F;P3;FG0L;" . ($num == 1 ? "Y" . $row . ";" : "") . "X{$num}\n";
                     $out .= "C;N;K\"" . self::sylk_clean($val) . "\"\n";
                 }
             }
             $out .= "E\n";
             break;
         case self::CSV_OUTPUT:
             //csv
             break;
         default:
             $out = "</table></div>\n";
     }
     return $out;
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:67,代码来源:searcha.class.php

示例4: generatePdf

 function generatePdf($itemtype, $data, $saveas)
 {
     global $CFG_GLPI, $PDF, $DB;
     $ID = $data["id"];
     //name
     if (!empty($data["name"])) {
         $name_item = Toolbox::decodeFromUtf8($data["name"]);
     } else {
         $name_item = "";
     }
     //user
     if (!empty($data["users_id"])) {
         $user_item = Toolbox::decodeFromUtf8(Html::clean(getUserName($data["users_id"])));
     } else {
         if (!empty($data["groups_id"])) {
             $user_item = Toolbox::decodeFromUtf8(Dropdown::getDropdownName("glpi_groups", $data["groups_id"]));
         } else {
             $user_item = "";
         }
     }
     //fabricant
     if (!empty($data["manufacturers_id"])) {
         $fabricant_item = Toolbox::decodeFromUtf8(Dropdown::getDropdownName("glpi_manufacturers", $data["manufacturers_id"]));
     } else {
         $fabricant_item = "";
     }
     //serial
     if (!empty($data["serial"])) {
         $serial_item = Toolbox::decodeFromUtf8($data["serial"]);
     } else {
         $serial_item = "";
     }
     $class = $itemtype . "Type";
     $item = new $class();
     $typefield = getForeignKeyFieldForTable(getTableForItemType($itemtype . "Type"));
     $item->getFromDB($data[$typefield]);
     if (!empty($typefield) && !empty($item->fields["name"])) {
         $type_item = Toolbox::decodeFromUtf8($item->fields["name"]);
     } else {
         $type_item = "";
     }
     //infocoms
     $ic = new Infocom();
     if ($ic->getfromDBforDevice($itemtype, $ID)) {
         //immobilizationsheets_item
         if (!empty($ic->fields["immo_number"])) {
             $immobilizationsheets_item = Toolbox::decodeFromUtf8($ic->fields["immo_number"]);
         } else {
             $immobilizationsheets_item = "";
         }
         //buy_date
         if (!empty($ic->fields["buy_date"])) {
             $buy_date_item = Toolbox::decodeFromUtf8(Html::convdate($ic->fields["buy_date"]));
         } else {
             $buy_date_item = "";
         }
         //use_date
         if (!empty($ic->fields["use_date"])) {
             $use_date_item = Toolbox::decodeFromUtf8(Html::convdate($ic->fields["use_date"]));
         } else {
             $use_date_item = "";
         }
         //order_number
         if (!empty($ic->fields["order_number"])) {
             $order_number_item = Toolbox::decodeFromUtf8($ic->fields["order_number"]);
         } else {
             $order_number_item = "";
         }
         //value_item
         if (!empty($ic->fields["value"])) {
             $value_item = Toolbox::decodeFromUtf8(Html::clean(Html::formatNumber($ic->fields["value"])));
         } else {
             $value_item = "";
         }
         //sink_time
         if (!empty($ic->fields["sink_time"])) {
             $sink_time_item = Toolbox::decodeFromUtf8(sprintf(_n('%d year', '%d years', $ic->fields["sink_time"]), $ic->fields["sink_time"]));
         } else {
             $sink_time_item = "";
         }
         //sink_type
         if (!empty($ic->fields["sink_type"])) {
             $sink_type_item = Toolbox::decodeFromUtf8(Infocom::getAmortTypeName($ic->fields["sink_type"]));
         } else {
             $sink_type_item = "";
         }
     } else {
         $immobilizationsheets_item = "";
         $buy_date_item = "";
         $use_date_item = "";
         $order_number_item = "";
         $value_item = "";
         $sink_time_item = "";
         $sink_type_item = "";
     }
     //composants
     $devtypes = self::getDeviceTypes();
     if ($itemtype == 'Computer') {
         $device2 = new $devtypes[2]();
         $query2 = "SELECT `deviceprocessors_id`\n                  FROM `" . getTableForItemType('items_' . $devtypes[2]) . "`\n                  WHERE `items_id` = '{$ID}'";
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:item.class.php

示例5: Footer

 /**
  * Fonction permettant de dessiner le pied de page du rapport.
  */
 function Footer()
 {
     // Positionnement par rapport au bas de la page.
     $this->SetY(-$this->tail_bas_page);
     /* Numéro de page. */
     $this->SetFont($this->pol_def, '', 9);
     $this->Cell(0, $this->tail_bas_page / 2, Toolbox::decodeFromUtf8("") . ' ' . $this->PageNo() . ' ' . Toolbox::decodeFromUtf8("") . ' ', 0, 0, 'C');
     $this->Ln(10);
     /* Infos ODAXYS. */
     $this->SetFont($this->pol_def, 'I', 9);
     $this->Cell(0, $this->tail_bas_page / 4, Toolbox::decodeFromUtf8(""), 0, 0, 'C');
     $this->Ln(5);
     $this->Cell(0, $this->tail_bas_page / 4, Toolbox::decodeFromUtf8(""), 0, 0, 'C');
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:17,代码来源:pdf.class.php

示例6: mailAuth

 /**
  * Authentify a user by checking a specific mail server
  *
  * @param $auth         identification object
  * @param $login        user login
  * @param $password     user password
  * @param $mail_method  mail_method array to use
  *
  * @return identification object
  **/
 static function mailAuth($auth, $login, $password, $mail_method)
 {
     if (isset($mail_method["connect_string"]) && !empty($mail_method["connect_string"])) {
         $auth->auth_succeded = $auth->connection_imap($mail_method["connect_string"], Toolbox::decodeFromUtf8($login), Toolbox::decodeFromUtf8($password));
         if ($auth->auth_succeded) {
             $auth->extauth = 1;
             $auth->user_present = $auth->user->getFromDBbyName(addslashes($login));
             $auth->user->getFromIMAP($mail_method, Toolbox::decodeFromUtf8($login));
             //Update the authentication method for the current user
             $auth->user->fields["authtype"] = Auth::MAIL;
             $auth->user->fields["auths_id"] = $mail_method["id"];
         }
     }
     return $auth;
 }
开发者ID:btry,项目名称:glpi,代码行数:25,代码来源:authmail.class.php

示例7: showItem

 /**
  * Print generic normal Item Cell
  *
  * @param $type         display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
  * @param $value        value to display
  * @param &$num         column number
  * @param $row          row number
  * @param $extraparam   extra parameters for display (default '')
  *
  * @return string to display
  * */
 static function showItem($type, $value, &$num, $row, $extraparam = '', $params = array())
 {
     $out = "";
     switch ($type) {
         case Search::PDF_OUTPUT_LANDSCAPE:
             //pdf
         //pdf
         case Search::PDF_OUTPUT_PORTRAIT:
             global $PDF_TABLE;
             $value = preg_replace('/' . Search::LBBR . '/', '<br>', $value);
             $value = preg_replace('/' . Search::LBHR . '/', '<hr>', $value);
             $PDF_TABLE .= "<td {$extraparam} valign='top'>";
             $PDF_TABLE .= Html::weblink_extract(Html::clean($value));
             $PDF_TABLE .= "</td>\n";
             break;
         case Search::SYLK_OUTPUT:
             //sylk
             global $SYLK_ARRAY, $SYLK_HEADER, $SYLK_SIZE;
             $value = Html::weblink_extract($value);
             $value = preg_replace('/' . Search::LBBR . '/', '<br>', $value);
             $value = preg_replace('/' . Search::LBHR . '/', '<hr>', $value);
             $SYLK_ARRAY[$row][$num] = Search::sylk_clean($value);
             $SYLK_SIZE[$num] = max($SYLK_SIZE[$num], Toolbox::strlen($SYLK_ARRAY[$row][$num]));
             break;
         case Search::CSV_OUTPUT:
             //csv
             $value = preg_replace('/' . Search::LBBR . '/', '<br>', $value);
             $value = preg_replace('/' . Search::LBHR . '/', '<hr>', $value);
             $value = Html::weblink_extract($value);
             $quotes = "";
             if ($params['quotes']) {
                 $quotes = "\"";
             }
             switch ($params['encoding']) {
                 case self::ANSI_ENCODING:
                     $out = "{$quotes}" . Toolbox::decodeFromUtf8(Search::csv_clean($value), 'windows-1252') . "{$quotes}" . $_SESSION["glpicsv_delimiter"];
                     break;
                 case self::UTF8_ENCODING:
                     $out = "{$quotes}" . Search::csv_clean($value) . "{$quotes}" . $_SESSION["glpicsv_delimiter"];
                     break;
             }
             break;
         default:
             $out = "<td {$extraparam} valign='top'>";
             if (!preg_match('/' . Search::LBHR . '/', $value)) {
                 $values = preg_split('/' . Search::LBBR . '/i', $value);
                 $line_delimiter = '<br>';
             } else {
                 $values = preg_split('/' . Search::LBHR . '/i', $value);
                 $line_delimiter = '<hr>';
             }
             $limitto = 20;
             if (count($values) > $limitto) {
                 for ($i = 0; $i < $limitto; $i++) {
                     $out .= $values[$i] . $line_delimiter;
                 }
                 //                $rand=mt_rand();
                 $out .= "...&nbsp;";
                 $value = preg_replace('/' . Search::LBBR . '/', '<br>', $value);
                 $value = preg_replace('/' . Search::LBHR . '/', '<hr>', $value);
                 $out .= Html::showToolTip($value, array('display' => false, 'autoclose' => false));
             } else {
                 $value = preg_replace('/' . Search::LBBR . '/', '<br>', $value);
                 $value = preg_replace('/' . Search::LBHR . '/', '<hr>', $value);
                 $out .= $value;
             }
             $out .= "</td>\n";
     }
     $num++;
     return $out;
 }
开发者ID:sx3052,项目名称:racks,代码行数:82,代码来源:report.class.php

示例8: displayText

 /**
  * Display a multi-line Box : 1 column only
  *
  * @param $name      string   display on the left, before text
  * @param $content   string   of text display on right (multi-line)
  * @param $minline   integer  for minimum box size (default 3)
  * @param $maxline   interger for maximum box size (1 page = 80 lines) (default 100)
  **/
 public function displayText($name, $content = '', $minline = 3, $maxline = 100)
 {
     // New page if less than $minline available
     if ($this->start_tab < 20 + 10 / $minline) {
         $this->newPage();
     }
     // The Box	Initial Size = $minline
     $gray = 0.95;
     $this->pdf->saveState();
     $this->pdf->setColor($gray, $gray, $gray);
     $this->pdf->filledRectangle(25, $bottom = $this->start_tab - $minline * 10 + 5, $this->width - 50, $minline * 10 + 5);
     $this->pdf->restoreState();
     // Title
     $name = Toolbox::decodeFromUtf8($name, "windows-1252");
     $x = 30 + $this->pdf->getTextWidth(9, $name);
     $this->pdf->addText(27, $this->start_tab, 9, $name);
     $temp = str_replace("\r\n", "\n", $content);
     $lines = explode("\n", Toolbox::decodeFromUtf8($temp, "windows-1252"));
     $line = current($lines);
     // Content
     while ($line !== false && $maxline > 0) {
         // Need a new page ?
         if ($this->start_tab < 30) {
             $this->newPage();
             $bottom = $this->start_tab + 10;
         }
         // Extent initial box
         if ($this->start_tab < $bottom) {
             $newbottom = $this->start_tab - 5;
             $this->pdf->saveState();
             $this->pdf->setColor($gray, $gray, $gray);
             $this->pdf->filledRectangle(25, $newbottom, $this->width - 50, $bottom - $newbottom);
             $this->pdf->restoreState();
             $bottom = $newbottom;
         }
         if (!empty($line)) {
             $line = $this->pdf->addTextWrap($x, $this->start_tab, $this->width - $x - 25, 9, $line);
         }
         if (empty($line)) {
             $line = next($lines);
         }
         $this->start_tab -= 10;
         $maxline--;
     }
     // Final position = behind the box
     $this->start_tab = $bottom - 15;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:55,代码来源:simplepdf.class.php


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