本文整理汇总了PHP中utf8::to_ascii方法的典型用法代码示例。如果您正苦于以下问题:PHP utf8::to_ascii方法的具体用法?PHP utf8::to_ascii怎么用?PHP utf8::to_ascii使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utf8
的用法示例。
在下文中一共展示了utf8::to_ascii方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: encode_field
if (isset($item['language']) && $item['language'] && $item['language'] != 'none') {
$text .= ' <dc:language>' . $item['language'] . '</dc:language>' . "\n";
}
if (is_object($anchor)) {
$text .= ' <dc:subject>' . encode_field($anchor->get_title()) . '</dc:subject>' . "\n";
}
$text .= ' </rdf:Description>' . "\n" . '</rdf:RDF>';
//
// transfer to the user agent
//
// handle the output correctly
render_raw('text/xml; charset=' . $context['charset']);
// suggest a name on download
if (!headers_sent()) {
$file_name = Skin::strip($context['page_title']) . '.opml.xml';
$file_name =& utf8::to_ascii($file_name);
Safe::header('Content-Disposition: inline; filename="' . str_replace('"', '', $file_name) . '"');
}
// enable 30-minute caching (30*60 = 1800), even through https, to help IE6 on download
http::expire(1800);
// strong validator
$etag = '"' . md5($text) . '"';
// manage web cache
if (http::validate(NULL, $etag)) {
return;
}
// actual transmission except on a HEAD request
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
echo $text;
}
// the post-processing hook, then exit
示例2: render_raw
$text .= $separator;
}
$text .= $content;
}
// only one script has been asked
if (count($script) == 1) {
// compress the page if possible, but no transcoding -- the bare handler
$context['charset'] = 'ASCII';
render_raw('text/x-httpd-php');
// send the response to the caller
if (!headers_sent()) {
Safe::header('Content-Description: Reference file from YACS environment');
}
// suggest a download
if (!headers_sent()) {
$file_name = utf8::to_ascii(basename($script[0]));
Safe::header('Content-Disposition: attachment; filename="' . str_replace('"', '', $file_name) . '"');
}
// several scripts at one
} else {
// multi-part separator on the first line
$text = $separator . $text;
// compress the page if possible, but no transcoding -- the bare handler
$context['charset'] = 'ASCII';
render_raw('text/html');
// send the response to the caller
if (!headers_sent()) {
Safe::header('Content-Description: Reference files from YACS environment');
}
}
// enable 30-minute caching (30*60 = 1800), even through https, to help IE6 on download
示例3: build
/**
* build one table
*
* Accept following variants:
* - csv - to provide a downloadable csv page
* - json - to provide all values in one column
* - inline - to render tables within articles
* - simple - the legacy fixed table
* - sortable - click on column to sort the row
*
* @param the id of the table to build
* @param string the variant to provide - default is 'simple'
* @return a displayable string
*/
public static function build($id, $variant = 'simple')
{
global $context;
// split parameters
$attributes = preg_split("/\\s*,\\s*/", $id, 3);
$id = $attributes[0];
// get the table object
if (!($table = Tables::get($id))) {
return NULL;
}
// do the SELECT statement
if (!($rows = SQL::query($table['query']))) {
Logger::error(sprintf(i18n::s('Error in table query %s'), $id) . BR . htmlspecialchars($table['query']) . BR . SQL::error());
return NULL;
}
// build the resulting string
$text = '';
switch ($variant) {
// produce a table readable into MS-Excel
case 'csv':
// comma separated values
$separator = ",";
// one row for the title
if ($table['title']) {
$label = preg_replace('/\\s/', ' ', $table['title']);
// encode to ASCII
$label = utf8::to_ascii($label, PRINTABLE_SAFE_ALPHABET);
// escape quotes to preserve them in the data
$label = str_replace('"', '""', $label);
$text .= '"' . $label . '"';
$text .= "\n";
}
// one row for header fields
$index = 0;
while ($field = SQL::fetch_field($rows)) {
if ($index++) {
$text .= $separator;
}
$label = trim(preg_replace('/\\s/', ' ', ucfirst($field->name)));
// encode
$label = utf8::to_ascii($label, PRINTABLE_SAFE_ALPHABET);
// escape quotes to preserve them in the data
$label = str_replace('"', '""', $label);
$text .= '"' . $label . '"';
}
$text .= "\n";
// process every table row
$row_index = 0;
while ($row = SQL::fetch($rows)) {
// one cell at a time
$index = 0;
foreach ($row as $name => $value) {
// glue cells
if ($index++) {
$text .= $separator;
}
// remove HTML tags
$value = strip_tags(str_replace('</', ' </', str_replace(BR, ' / ', $value)));
// clean spaces
$label = trim(preg_replace('/\\s+/', ' ', $value));
// encode
$label = utf8::to_ascii($label, PRINTABLE_SAFE_ALPHABET);
// escape quotes to preserve them in the data
$label = str_replace('"', '""', $label);
// make a link if this is a reference
if ($index == 1 && $table['with_zoom'] == 'Y') {
$label = $context['url_to_home'] . $context['url_to_root'] . $label;
}
// quote data
$text .= '"' . $label . '"';
}
// new line
$text .= "\n";
}
return $text;
// a JSON set of values
// a JSON set of values
case 'json':
// get header labels
$labels = array();
while ($field = SQL::fetch_field($rows)) {
$labels[] = trim(preg_replace('/[^\\w]+/', '', ucfirst($field->name)));
}
// all items
$data = array();
$data['items'] = array();
//.........这里部分代码省略.........
示例4: render_raw
// make a text
include_once '../services/codec.php';
include_once '../services/rss_codec.php';
$result = rss_Codec::encode($values);
$text = @$result[1];
// save in cache for the next request
Cache::put($cache_id, $text, 'articles');
}
//
// transfer to the user agent
//
// handle the output correctly
render_raw('text/xml; charset=' . $context['charset']);
// suggest a name on download
if (!headers_sent()) {
$file_name = utf8::to_ascii($context['site_name'] . '.category.' . $item['id'] . '.rss.xml');
Safe::header('Content-Disposition: inline; filename="' . str_replace('"', '', $file_name) . '"');
}
// enable 30-minute caching (30*60 = 1800), even through https, to help IE6 on download
http::expire(1800);
// strong validator
$etag = '"' . md5($text) . '"';
// manage web cache
if (http::validate(NULL, $etag)) {
return;
}
// actual transmission except on a HEAD request
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
echo $text;
}
// the post-processing hook, then exit
示例5: substr
}
// genre
if ($value = implode(', ', @$data['comments_html']['genre'])) {
Safe::header("icy-genre: " . utf8::to_iso8859(utf8::transcode($value)));
}
// audio bitrate
if ($value = @$data['audio']['bitrate']) {
Safe::header("icy-br: " . substr($value, 0, -3));
}
// this server
Safe::header("icy-url: " . $context['url_to_home'] . $context['url_to_root']);
}
// serve the right type
Safe::header('Content-Type: ' . Files::get_mime_type($item['file_name']));
// suggest a name for the saved file
$file_name = utf8::to_ascii($item['file_name']);
Safe::header('Content-Disposition: attachment; filename="' . str_replace('"', '', $file_name) . '"');
// we accepted (limited) range requests
Safe::header('Accept-Ranges: bytes');
// provide only a slice of the file
if (isset($_SERVER['HTTP_RANGE']) && !strncmp('bytes=', $_SERVER['HTTP_RANGE'], 6)) {
// maybe several ranges
$range = substr($_SERVER['HTTP_RANGE'], 6);
// process only the first range, if several are specified
if ($position = strpos($range, ',')) {
$range = substr($range, 0, $position);
}
// beginning and end of the range
list($offset, $end) = explode('-', $range);
$offset = intval($offset);
if (!$end) {
示例6: urlencode
$scope = '';
if ($id) {
$scope = '?id=' . urlencode($id);
}
// available blogging api
$text .= ' <apis>' . "\n" . ' <api name="MovableType" preferred="true" apiLink="' . $context['url_to_home'] . $context['url_to_root'] . 'services/blog.php' . $scope . '" blogID="' . encode_field($id) . '" />' . "\n" . ' <api name="MetaWeblog" preferred="false" apiLink="' . $context['url_to_home'] . $context['url_to_root'] . 'services/blog.php' . $scope . '" blogID="' . encode_field($id) . '" />' . "\n" . ' <api name="Blogger" preferred="false" apiLink="' . $context['url_to_home'] . $context['url_to_root'] . 'services/blog.php' . $scope . '" blogID="' . encode_field($id) . '" />' . "\n" . ' </apis>' . "\n";
// the postamble
$text .= '</service>' . "\n" . '</rsd>' . "\n";
//
// transfer to the user agent
//
// handle the output correctly
render_raw('application/rsd+xml; charset=' . $context['charset']);
// suggest a name on download
if (!headers_sent()) {
$file_name = utf8::to_ascii($context['site_name'] . '.rsd.xml');
Safe::header('Content-Disposition: inline; filename="' . str_replace('"', '', $file_name) . '"');
}
// enable 30-minute caching (30*60 = 1800), even through https, to help IE6 on download
http::expire(1800);
// strong validator
$etag = '"' . md5($text) . '"';
// manage web cache
if (http::validate(NULL, $etag)) {
return;
}
// actual transmission except on a HEAD request
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
echo $text;
}
// the post-processing hook
示例7: elseif
// an error occured
} elseif (count($context['error'])) {
} else {
// put in the calendar, no more
$method = 'PUBLISH';
// get the full text of the event invitation
$text = $overlay->get_ics($method);
// no encoding, no compression and no yacs handler...
if (!headers_sent()) {
Safe::header('Content-Type: text/calendar; method="' . $method . '"; charset="UTF-8"');
Safe::header('Content-Transfer-Encoding: binary');
Safe::header('Content-Length: ' . strlen($text));
}
// suggest a download
if (!headers_sent()) {
$file_name = utf8::to_ascii(Skin::strip($anchor->get_title(false)) . '.ics');
Safe::header('Content-Disposition: attachment; filename="' . str_replace('"', '', $file_name) . '"');
}
// enable 30-minute caching (30*60 = 1800), even through https, to help IE6 on download
http::expire(1800);
// strong validator
$etag = '"' . md5($text) . '"';
// manage web cache
if (http::validate(NULL, $etag)) {
return;
}
// actual transmission except on a HEAD request
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
echo $text;
}
// the post-processing hook, then exit
示例8: array
$rows[] = array(i18n::s('Source'), $item['source']);
}
// keywords
if ($item['keywords']) {
$rows[] = array(i18n::s('Keywords'), $item['keywords']);
}
// display these details
$context['text'] .= Skin::table(NULL, $rows);
// insert anchor prefix
if (is_object($anchor)) {
$context['text'] .= $anchor->get_prefix();
}
// if we have a local file
if (!isset($item['file_href']) || !$item['file_href']) {
// where the file is
$path = $context['path_to_root'] . Files::get_path($item['anchor']) . '/' . rawurlencode(utf8::to_ascii($item['file_name']));
//load some file parser if one is available
$analyzer = NULL;
if (is_readable($context['path_to_root'] . 'included/getid3/getid3.php')) {
include_once $context['path_to_root'] . 'included/getid3/getid3.php';
$analyzer = new getid3();
}
// parse file content, and streamline information
$data = array();
if (is_object($analyzer) && Files::is_stream($item['file_name'])) {
$data = $analyzer->analyze($path);
getid3_lib::CopyTagsToComments($data);
}
// details
$rows = array();
// artist
示例9: trim
Versions::save($item, 'file:' . $item['id']);
}
// assume this is just an update of the record
$action = 'file:update';
// true when several files are uploaded at once
$exploded = FALSE;
// this record is a reference to an external file -- do not take upload into account, if any
if (isset($_REQUEST['file_href']) && $_REQUEST['file_href']) {
// protect from hackers -- encode_link() would introduce &
$_REQUEST['file_href'] = trim(preg_replace(FORBIDDEN_IN_URLS, '_', $_REQUEST['file_href']), ' _');
// ensure we have a title
if (!$_REQUEST['title']) {
$_REQUEST['title'] = str_replace('%20', ' ', basename($_REQUEST['file_href']));
}
// ensure we have a file name
$_REQUEST['file_name'] = utf8::to_ascii(str_replace('%20', ' ', basename($_REQUEST['file_href'])));
// change has been documented
if (!isset($_REQUEST['version']) || !$_REQUEST['version']) {
$_REQUEST['version'] = '';
} else {
$_REQUEST['version'] = ' - ' . $_REQUEST['version'];
}
// always remember file uploads, for traceability
$_REQUEST['version'] = $_REQUEST['file_name'] . ' (' . Skin::build_number($_REQUEST['file_size'], i18n::s('bytes')) . ')' . $_REQUEST['version'];
// add to file history
$_REQUEST['description'] = Files::add_to_history($item, $_REQUEST['version']);
// when the file has been overlaid
if (is_object($overlay)) {
// allow for change detection
$overlay->snapshot();
// update the overlay from form content
示例10: foreach
foreach ($items as $id => $attributes) {
// read file content
if ($content = Safe::file_get_contents($file_path . '/' . $attributes['file_name'], 'rb')) {
// add the binary data
$zipfile->deflate($attributes['file_name'], Safe::filemtime($file_path . '/' . $attributes['file_name']), $content);
}
}
//
// transfer to the user agent
//
// send the archive content
if ($archive = $zipfile->get()) {
// suggest a download
Safe::header('Content-Type: application/octet-stream');
// suggest a name for the saved file
$file_name = utf8::to_ascii($item['title']) . '.zip';
Safe::header('Content-Disposition: attachment; filename="' . str_replace('"', '', $file_name) . '"');
// file size
Safe::header('Content-Length: ' . strlen($archive));
// already encoded
Safe::header('Content-Transfer-Encoding: binary');
// enable 30-minute caching (30*60 = 1800), even through https, to help IE on download
http::expire(1800);
// strong validator
$etag = '"' . md5($archive) . '"';
// manage web cache
if (http::validate(NULL, $etag)) {
return;
}
// actual transmission except on a HEAD request
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
示例11: strip_tags
Safe::header('Status: 401 Unauthorized', TRUE, 401);
Logger::error(i18n::s('You are not allowed to perform this operation.'));
// display the table in CSV
} else {
// force the character set
$context['charset'] = 'iso-8859-15';
// render actual table content
$text = strip_tags(Tables::build($item['id'], 'raw'));
//
// transfer to the user agent
//
// handle the output correctly
render_raw('text/csv; charset=' . $context['charset']);
// suggest a download
if (!headers_sent()) {
$file_name = utf8::to_ascii(Skin::strip($item['title']) . '.csv');
Safe::header('Content-Disposition: attachment; filename="' . str_replace('"', '', $file_name) . '"');
}
// enable 30-minute caching (30*60 = 1800), even through https, to help IE6 on download
http::expire(1800);
// strong validator
$etag = '"' . md5($text) . '"';
// manage web cache
if (http::validate(NULL, $etag)) {
return;
}
// actual transmission except on a HEAD request
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
echo $text;
}
// the post-processing hook, then exit
示例12: explode_callback
function explode_callback($name)
{
global $context;
// reject all files put in sub-folders
if (($path = substr($name, strlen($context['uploaded_path'] . '/'))) && strpos($path, '/') !== FALSE) {
Safe::unlink($name);
} elseif (!Files::is_authorized($name)) {
Safe::unlink($name);
} else {
// make it easy to download
$ascii = utf8::to_ascii(basename($name));
Safe::rename($name, $context['uploaded_path'] . '/' . $ascii);
// remember this name
$context['uploaded_files'][] = $ascii;
}
}
示例13: render_embed
//.........这里部分代码省略.........
if (FLV_IMG_HREF) {
$flashvars .= '&top1=' . urlencode(FLV_IMG_HREF . '|10|10');
}
// rely on Flash
if (Surfer::has_flash()) {
// the full object is built in Javascript --see parameters at http://flv-player.net/players/maxi/documentation/
$output = '<div id="flv_' . $item['id'] . '" class="no_print">Flash plugin or Javascript are turned off. Activate both and reload to view the object</div>' . "\n";
Page::insert_script('var flashvars = { flv:"' . $url . '", ' . str_replace(array('&', '='), array('", ', ':"'), $flashvars) . '", autoload:0, margin:1, showiconplay:1, playeralpha:50, iconplaybgalpha:30, showfullscreen:1, showloading:"always", ondoubleclick:"fullscreen" }' . "\n" . 'var params = { allowfullscreen: "true", allowscriptaccess: "always" }' . "\n" . 'var attributes = { id: "file_' . $item['id'] . '", name: "file_' . $item['id'] . '"}' . "\n" . 'swfobject.embedSWF("' . $flvplayer_url . '", "flv_' . $item['id'] . '", "' . $width . '", "' . $height . '", "9", "' . $context['url_to_home'] . $context['url_to_root'] . 'included/browser/expressinstall.swf", flashvars, params);' . "\n");
// native support
} else {
// <video> is HTML5, <object> is legacy
$output = '<video width="' . $width . '" height="' . $height . '" autoplay="" controls="" src="' . $url . '" >' . "\n" . ' <object width="' . $width . '" height="' . $height . '" data="' . $url . '" type="' . Files::get_mime_type($item['file_name']) . '">' . "\n" . ' <param value="' . $url . '" name="movie" />' . "\n" . ' <param value="true" name="allowFullScreen" />' . "\n" . ' <param value="always" name="allowscriptaccess" />' . "\n" . ' <a href="' . $url . '">No video playback capabilities, please download the file</a>' . "\n" . ' </object>' . "\n" . '</video>' . "\n";
}
// job done
return $output;
// a ganttproject timeline
// a ganttproject timeline
case 'gan':
// where the file is
$path = Files::get_path($item['anchor']) . '/' . rawurlencode($item['file_name']);
// we actually use a transformed version of the file
$cache_id = Cache::hash($path) . '.xml';
// apply the transformation
if (!file_exists($context['path_to_root'] . $cache_id) || filemtime($context['path_to_root'] . $cache_id) < filemtime($context['path_to_root'] . $path) || !($text = Safe::file_get_contents($context['path_to_root'] . $cache_id))) {
// transform from GanttProject to SIMILE Timeline
$text = Files::transform_gan_to_simile($path);
// put in cache
Safe::file_put_contents($cache_id, $text);
}
// load the SIMILE Timeline javascript library in shared/global.php
$context['javascript']['timeline'] = TRUE;
// cache would kill the loading of the library
cache::poison();
// 1 week ago
$now = gmdate('M d Y H:i:s', time() - 7 * 24 * 60 * 60);
// load the right file
$output = '<div id="gantt" style="height: ' . $height . '; width: ' . $width . '; border: 1px solid #aaa; font-family: Trebuchet MS, Helvetica, Arial, sans serif; font-size: 8pt"></div>' . "\n";
Page::insert_script('var simile_handle;' . "\n" . 'function onLoad() {' . "\n" . ' var eventSource = new Timeline.DefaultEventSource();' . "\n" . ' var theme = Timeline.ClassicTheme.create();' . "\n" . ' theme.event.bubble.width = 350;' . "\n" . ' theme.event.bubble.height = 300;' . "\n" . ' var bandInfos = [' . "\n" . ' Timeline.createBandInfo({' . "\n" . ' eventSource: eventSource,' . "\n" . ' date: "' . $now . '",' . "\n" . ' width: "80%",' . "\n" . ' intervalUnit: Timeline.DateTime.WEEK,' . "\n" . ' intervalPixels: 200,' . "\n" . ' theme: theme,' . "\n" . ' layout: "original" // original, overview, detailed' . "\n" . ' }),' . "\n" . ' Timeline.createBandInfo({' . "\n" . ' showEventText: false,' . "\n" . ' trackHeight: 0.5,' . "\n" . ' trackGap: 0.2,' . "\n" . ' eventSource: eventSource,' . "\n" . ' date: "' . $now . '",' . "\n" . ' width: "20%",' . "\n" . ' intervalUnit: Timeline.DateTime.MONTH,' . "\n" . ' intervalPixels: 50' . "\n" . ' })' . "\n" . ' ];' . "\n" . ' bandInfos[1].syncWith = 0;' . "\n" . ' bandInfos[1].highlight = true;' . "\n" . ' bandInfos[1].eventPainter.setLayout(bandInfos[0].eventPainter.getLayout());' . "\n" . ' simile_handle = Timeline.create(document.getElementById("gantt"), bandInfos, Timeline.HORIZONTAL);' . "\n" . ' simile_handle.showLoadingMessage();' . "\n" . ' Timeline.loadXML("' . $context['url_to_home'] . $context['url_to_root'] . $cache_id . '", function(xml, url) { eventSource.loadXML(xml, url); });' . "\n" . ' simile_handle.hideLoadingMessage();' . "\n" . '}' . "\n" . "\n" . 'var resizeTimerID = null;' . "\n" . 'function onResize() {' . "\n" . ' if (resizeTimerID == null) {' . "\n" . ' resizeTimerID = window.setTimeout(function() {' . "\n" . ' resizeTimerID = null;' . "\n" . ' simile_handle.layout();' . "\n" . ' }, 500);' . "\n" . ' }' . "\n" . '}' . "\n" . "\n" . '// observe page major events' . "\n" . '$(document).ready( onLoad);' . "\n" . '$(window).resize(onResize);' . "\n");
// job done
return $output;
// a Freemind map
// a Freemind map
case 'mm':
// if we have an external reference, use it
if (isset($item['file_href']) && $item['file_href']) {
$target_href = $item['file_href'];
// else redirect to ourself
} else {
// ensure a valid file name
$file_name = utf8::to_ascii($item['file_name']);
// where the file is
$path = Files::get_path($item['anchor']) . '/' . rawurlencode($item['file_name']);
// map the file on the regular web space
$url_prefix = $context['url_to_home'] . $context['url_to_root'];
// redirect to the actual file
$target_href = $url_prefix . $path;
}
// allow several viewers to co-exist in the same page
static $freemind_viewer_index;
if (!isset($freemind_viewer_index)) {
$freemind_viewer_index = 1;
} else {
$freemind_viewer_index++;
}
// load flash player
$url = $context['url_to_home'] . $context['url_to_root'] . 'included/browser/visorFreemind.swf';
// variables
$flashvars = 'initLoadFile=' . $target_href . '&openUrl=_self';
$output = '<div id="freemind_viewer_' . $freemind_viewer_index . '">Flash plugin or Javascript are turned off. Activate both and reload to view the object</div>' . "\n";
Page::insert_script('var params = {};' . "\n" . 'params.base = "' . dirname($url) . '/";' . "\n" . 'params.quality = "high";' . "\n" . 'params.wmode = "transparent";' . "\n" . 'params.menu = "false";' . "\n" . 'params.flashvars = "' . $flashvars . '";' . "\n" . 'swfobject.embedSWF("' . $url . '", "freemind_viewer_' . $freemind_viewer_index . '", "' . $width . '", "' . $height . '", "6", "' . $context['url_to_home'] . $context['url_to_root'] . 'included/browser/expressinstall.swf", false, params);' . "\n");
// offer to download a copy of the map
$menu = array($target_href => i18n::s('Browse this map with Freemind'));
// display menu commands below the viewer
$output .= Skin::build_list($menu, 'menu_bar');
// job done
return $output;
// native flash
// native flash
case 'swf':
// where to get the file
if (isset($item['file_href']) && $item['file_href']) {
$url = $item['file_href'];
} else {
$url = $context['url_to_home'] . $context['url_to_root'] . 'files/' . str_replace(':', '/', $item['anchor']) . '/' . rawurlencode($item['file_name']);
}
$output = '<div id="swf_' . $item['id'] . '" class="no_print">Flash plugin or Javascript are turned off. Activate both and reload to view the object</div>' . "\n";
Page::insert_script('var params = {};' . "\n" . 'params.base = "' . dirname($url) . '/";' . "\n" . 'params.quality = "high";' . "\n" . 'params.wmode = "transparent";' . "\n" . 'params.allowfullscreen = "true";' . "\n" . 'params.allowscriptaccess = "always";' . "\n" . 'params.flashvars = "' . $flashvars . '";' . "\n" . 'swfobject.embedSWF("' . $url . '", "swf_' . $item['id'] . '", "' . $width . '", "' . $height . '", "6", "' . $context['url_to_home'] . $context['url_to_root'] . 'included/browser/expressinstall.swf", false, params);' . "\n");
return $output;
// link to file page
// link to file page
default:
// link label
$text = Skin::strip($item['title'] ? $item['title'] : str_replace('_', ' ', $item['file_name']));
// make a link to the target page
$url = Files::get_permalink($item);
// return a complete anchor
$output =& Skin::build_link($url, $text);
return $output;
}
}
示例14: strlen
if (!$fetched) {
// increment the count of downloads
if (!Surfer::is_crawler()) {
Files::increment_hits($item['id']);
}
// record surfer activity
Activities::post('file:' . $item['id'], 'fetch');
}
// no encoding, no compression and no yacs handler...
if (!headers_sent()) {
Safe::header('Content-Type: ' . $mime);
Safe::header('Content-Length: ' . strlen($text));
}
// suggest a download
if (!headers_sent()) {
$file_name = utf8::to_ascii($item['file_name'] . $type);
Safe::header('Content-Disposition: inline; filename="' . str_replace('"', '', $file_name) . '"');
}
// enable 30-minute caching (30*60 = 1800), even through https, to help IE6 on download
http::expire(1800);
// strong validator
$etag = '"' . md5($text) . '"';
// manage web cache
if (http::validate(NULL, $etag)) {
return;
}
// actual transmission except on a HEAD request
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
echo $text;
}
// the post-processing hook, then exit
示例15: render_raw
include_once '../services/codec.php';
include_once '../services/rss_codec.php';
$result = rss_Codec::encode($values);
$status = @$result[0];
$text = @$result[1];
// save in cache for the next request
Cache::put($cache_id, $text, 'articles');
}
//
// transfer to the user agent
//
// handle the output correctly
render_raw('text/xml; charset=' . $context['charset']);
// suggest a name on download
if (!headers_sent()) {
$file_name = utf8::to_ascii($context['site_name'] . '.section.' . $item['id'] . '.rss.xml');
Safe::header('Content-Disposition: inline; filename="' . str_replace('"', '', $file_name) . '"');
}
// enable 30-minute caching (30*60 = 1800), even through https, to help IE6 on download
http::expire(1800);
// strong validator
$etag = '"' . md5($text) . '"';
// manage web cache
if (http::validate(NULL, $etag)) {
return;
}
// actual transmission except on a HEAD request
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
echo $text;
}
// the post-processing hook, then exit