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


PHP utf8::to_xml方法代码示例

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


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

示例1: to_xml_recursively

 /**
  * transcode arrays recursively
  *
  * @param array the variable to convert
  * @return converted object (which is also the input array)
  */
 public static function to_xml_recursively(&$input)
 {
     global $context;
     // sanity check
     if (!is_array($input)) {
         return utf8::to_xml($input);
     }
     // process all attributes
     foreach ($input as $name => $value) {
         if (is_array($value)) {
             $input[$name] = utf8::to_xml_recursively($value);
         } else {
             $input[$name] = utf8::to_xml($value);
         }
     }
     return $input;
 }
开发者ID:rair,项目名称:yacs,代码行数:23,代码来源:utf8.php

示例2: get_start_url

 /**
  * the URL to start and to join the meeting
  *
  * @see overlays/events/start.php
  *
  * @return string the URL to redirect the user to the meeting, or NULL on error
  */
 function get_start_url()
 {
     global $context;
     // almost random passwords
     $this->initialize_passwords();
     // parameters to create a meeting
     $parameters = array();
     // use page id as meeting id
     $parameters[] = 'name=' . urlencode($this->attributes['id']);
     $parameters[] = 'meetingID=' . urlencode($this->attributes['id']);
     // surfer name, as authenticated by yacs
     $parameters[] = 'fullName=' . urlencode(Surfer::get_name());
     // moderator password
     $parameters[] = 'moderatorPW=' . urlencode($this->moderator_password);
     // participant password
     $parameters[] = 'attendeePW=' . urlencode($this->attendee_password);
     // ensure that the bridge number fits in the dialing plan
     $parameters[] = 'voiceBridge=' . urlencode(substr('7' . $this->attributes['id'] . '1234', 0, 5));
     // message displayed within the BigBlueButton session
     $welcome = '';
     // meeting title
     if (is_object($this->anchor)) {
         $welcome .= sprintf(i18n::s('%s: %s'), i18n::s('Title'), $this->anchor->get_title()) . "\n";
     }
     // meeting date
     if (isset($this->attributes['date_stamp'])) {
         $welcome .= sprintf(i18n::s('%s: %s'), i18n::s('Date'), Skin::build_date($this->attributes['date_stamp'], 'standalone')) . "\n";
     }
     // meeting duration
     if (isset($this->attributes['duration'])) {
         $welcome .= sprintf(i18n::s('%s: %s'), i18n::s('Duration'), $this->attributes['duration'] . ' ' . i18n::s('minutes')) . "\n";
     }
     // build a link to the owner page, if any
     if (is_object($this->anchor) && ($user = Users::get($this->anchor->get_value('owner_id')))) {
         $welcome .= sprintf(i18n::s('%s: %s'), i18n::s('Chairman'), $user['full_name']) . "\n";
     }
     // welcome message
     $parameters[] = 'welcome=' . urlencode($welcome);
     // return URL
     if (is_callable(array($this->anchor, 'get_url'))) {
         $parameters[] = 'logoutURL=' . urlencode($context['url_to_home'] . $context['url_to_root'] . $this->anchor->get_url());
     }
     // should we record this session?
     if ($this->with_session_recording()) {
         $parameters[] = 'record=true';
         $parameters[] = 'duration=125';
         // 2 hours max per recording
     }
     // link to create the meeting
     $url = $this->build_link('create', $parameters);
     // list most recent files that have been attached to this page
     $headers = NULL;
     $body = NULL;
     if (is_object($this->anchor) && ($files = Files::list_by_date_for_anchor($this->anchor->get_reference(), 0, 5, 'raw'))) {
         $headers = array("Content-Type: text/xml");
         // instruct the presentation module to pre-load these files
         $body = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<modules>' . "\n" . '	<module name="presentation">' . "\n";
         // list web address of each file
         foreach ($files as $file) {
             $body .= "\t\t" . '<document' . ' url="' . $context['url_to_home'] . $context['url_to_root'] . utf8::to_xml(Files::get_url($file['id'], 'fetch', $file['file_name'])) . '"' . ' name="' . utf8::to_xml($file['file_name']) . '"' . ' />' . "\n";
         }
         // end of the list of files
         $body .= '   </module>' . "\n" . '</modules>' . "\n";
     }
     // do create the meeting
     if (($response = http::proceed_natively($url, $headers, $body)) && ($xml = simplexml_load_string($response)) && $xml->returncode == 'SUCCESS') {
         // parameters to join the meeting
         $parameters = array();
         // use page id as meeting id
         $parameters[] = 'meetingID=' . urlencode($xml->meetingID);
         // surfer name, as authenticated by yacs
         $parameters[] = 'fullName=' . urlencode(Surfer::get_name());
         // moderator password
         $parameters[] = 'password=' . urlencode($xml->moderatorPW);
         // link to join the meeting
         $url = $this->build_link('join', $parameters);
         return $url;
     }
     // problem, darling!
     return NULL;
 }
开发者ID:rair,项目名称:yacs,代码行数:88,代码来源:bbb_meeting.php

示例3: encode

 /**
  * encode some PHP value into XML
  *
  * This function tries to guess the adequate type to use.
  * Following types are supported:
  * - array
  * - base64 - type has to be set explicitly for the encoding to take place
  * - boolean
  * - date - type has to be set explicitly to get a &lt;dateTime.iso8601> element
  * - double
  * - integer
  * - struct
  * - string - type has to be set explicitly for the encoding to take place
  *
  * @param mixed the parameter to encode
  * @param type, if any
  * @return string some XML
  */
 public static function encode($parameter, $type = '')
 {
     // a date
     if ($type == 'date') {
         if (is_string($parameter)) {
             $parameter = strtotime($parameter);
         }
         $items = getdate($parameter);
         return '<dateTime.iso8601>' . sprintf('%02d%02d%02dT%02d:%02d:%02d', $items['year'], $items['mon'], $items['mday'], $items['hours'], $items['minutes'], $items['seconds']) . '</dateTime.iso8601>';
     }
     // base 64
     if ($type == 'base64') {
         return '<base64>' . base64_encode($parameter) . '</base64>';
     }
     // a string --also fix possible errors in HTML image references
     if ($type == 'string') {
         return '<string>' . utf8::to_xml(preg_replace('|<img (.+?[^/])>|mi', '<img $1 />', $parameter)) . '</string>';
     }
     // a boolean
     if ($parameter === true || $parameter === false) {
         return '<boolean>' . ($parameter ? '1' : '0') . '</boolean>';
     }
     // an integer
     if (is_integer($parameter)) {
         return '<int>' . $parameter . '</int>';
     }
     // a double
     if (is_double($parameter)) {
         return '<double>' . $parameter . '</double>';
     }
     // an array
     if (is_array($parameter)) {
         // it's a struct
         if (key($parameter)) {
             $text = '';
             foreach ($parameter as $name => $value) {
                 $text .= "\t" . '<member><name>' . $name . '</name><value>' . XML_RPC_Codec::encode($value) . "</value></member>\n";
             }
             return '<struct>' . "\n" . $text . '</struct>';
             // else it's a plain array
         } else {
             $text = '';
             foreach ($parameter as $item) {
                 $text .= "\t" . '<value>' . XML_RPC_Codec::encode($item) . "</value>\n";
             }
             if ($text) {
                 return '<array><data>' . "\n" . $text . '</data></array>';
             } else {
                 return '<array><data /></array>';
             }
         }
     }
     // encode strings
     if (is_string($parameter) && ($parameter = trim($parameter)) && substr($parameter, 0, 1) != '<') {
         return '<string>' . utf8::to_xml(preg_replace('|<img (.+?[^/])>|mi', '<img $1 />', $parameter)) . '</string>';
     }
     // do not encode possibly encoded strings
     return $parameter;
 }
开发者ID:rair,项目名称:yacs,代码行数:77,代码来源:xml_rpc_codec.php


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