本文整理汇总了PHP中_compute_public_path函数的典型用法代码示例。如果您正苦于以下问题:PHP _compute_public_path函数的具体用法?PHP _compute_public_path怎么用?PHP _compute_public_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_compute_public_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEmbed
public function getEmbed($options = array())
{
$url = $this->getUrl();
$width = isset($options['width']) ? $options['width'] : sfSympalConfig::get('default_video_width', null, 400);
$height = isset($options['height']) ? $options['height'] : sfSympalConfig::get('default_video_height', null, 400);
$extension = $this->getExtension();
$id = $this->getDoctrineAsset()->getId();
if ($extension == 'swf') {
return sprintf('<object width="%s" height="%s">
<param name="movie" value="%s">
<embed src="%s" width="%s" height="%s">
</embed>
</object>', $width, $height, $url, $url, $width, $height);
} else {
if ($extension == 'flv') {
sympal_use_jquery();
sympal_use_javascript('/sfSympalPlugin/js/flowplayer.min.js');
return sprintf('<a href="%s" style="display:block;width:%spx;height:%spx;" id="asset_%s"></a>
<script language="JavaScript">
flowplayer("asset_%s", "%s");
</script>', $url, $width, $height, $id, $id, _compute_public_path('/sfSympalPlugin/js/flowplayer.swf', 'swf', 'swf'));
} else {
return $this->getLink($options);
}
}
}
示例2: getUrlToImage
public static function getUrlToImage($filename, $size, $format, $absolute = false)
{
sfContext::getInstance()->getConfiguration()->loadHelpers('Asset');
$sizeDirName = 'w_h';
if ($size) {
list($width, $height) = explode('x', $size, 2);
$sizeDirName = 'w' . $width . '_h' . $height;
}
$filepath = 'img/' . $format . '/' . $sizeDirName . '/' . $filename . '.' . $format;
return _compute_public_path($filepath, 'cache', $format, $absolute);
}
示例3: op_chat_get_sounds
function op_chat_get_sounds($absolute = false)
{
use_helper('Asset');
static $sounds;
$result = array();
if (!is_array($sounds)) {
$sounds = array('in' => '/opChatPlugin/sounds/in.mp3', 'out' => '/opChatPlugin/sounds/out.mp3', 'notice' => '/opChatPlugin/sounds/notice.mp3');
foreach ($sounds as $name => $sound) {
if (file_exists(sfConfig::get('sf_web_dir') . $sound)) {
$result[$name] = _compute_public_path($sound, sfConfig::get('sf_web_dir', ''), 'mp3', $absolute);
}
}
}
return empty($result) ? null : $result;
}
示例4: sf_image_path
function sf_image_path($filename, $options = array(), $absolute = false)
{
if (isset($options['f'])) {
$f = $options['f'];
unset($options['f']);
} else {
$parts = explode('.', $filename);
$f = array_pop($parts);
if ($f !== 'jpg' || $f !== 'png' || $f !== 'gif') {
$f = 'jpg';
}
}
$size_dir_name = 'w_h';
if (isset($options['size'])) {
list($width, $height) = explode('x', $options['size'], 2);
$size_dir_name = 'w' . $width . '_h' . $height;
unset($options['size']);
}
$filepath = 'img/' . $f . '/' . $size_dir_name . '/' . $filename;
$options['raw_name'] = true;
return _compute_public_path($filepath, 'cache', $f, $absolute);
}
示例5: sf_image_path
function sf_image_path($filename, $options = array(), $absolute = false)
{
if (isset($options['f'])) {
$f = $options['f'];
unset($options['f']);
} elseif (is_callable(array($filename, 'getType'))) {
$f = str_replace('image/', '', $filename->getType());
} else {
$parts = explode('_', $filename);
$f = array_pop($parts);
}
if ($f !== 'jpg' && $f !== 'png' && $f !== 'gif') {
$f = 'jpg';
}
$size_dir_name = 'w_h';
if (isset($options['size'])) {
list($width, $height) = explode('x', $options['size'], 2);
$size_dir_name = 'w' . $width . '_h' . $height;
unset($options['size']);
}
$filepath = 'img/' . $f . '/' . $size_dir_name . '/' . $filename . '.' . $f;
$options['raw_name'] = true;
return _compute_public_path($filepath, 'cache', $f, $absolute);
}
示例6: _compute_public_path
echo _compute_public_path('favicon', 'images', 'ico', true);
?>
" />
<link rel="icon" href="<?php
echo _compute_public_path('favicon', 'images', 'ico', true);
?>
" />
<!--FOR CSS File-->
<link href="<?php
echo _compute_public_path('style', 'css', 'css', false);
?>
" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<link href="<?php
echo _compute_public_path('iecss', 'css', 'css', false);
?>
" rel="stylesheet" type="text/css" />
<![endif]-->
</head>
<body>
<div id="main_container">
<div class="header">
<div id="logo">
<?php
if ($sf_user->isAuthenticated()) {
?>
<?php
示例7: executeRelated
//.........这里部分代码省略.........
// do the actual work
// $column = 0;
// $result_trackids = array_map('array_slice', $this->results, array_fill(0, count( $this->results), $column), array_fill(0, count( $this->results), 1));
$result_trackids = array();
foreach ($this->results as $key => $value) {
array_push($result_trackids, $value[0]);
}
mysfLog::log($this, "DEBUG: " . print_r($result_trackids, true));
$unique = array();
foreach ($result_trackids as $key => $value) {
if (!in_array($value, $unique)) {
array_push($unique, $value);
}
}
// $unique = array_unique($result_trackids);
//mysfLog::log($this, "DEBUG: " . print_r($unique, true));
foreach ($unique as $ukey => $uvalue) {
// segments for $value
$tmparray = array();
foreach ($aResultsEnhanced as $key => $value) {
if ($uvalue == $value['track_id']) {
array_push($tmparray, array('start' => $value['start'], 'end' => $value['end'], 'dist' => $value['dist']));
}
}
// Sort result segments ascending in start time
$fCmpSegments = create_function('$a, $b', '
if ($a[\'start\'] == $b[\'start\']) {
return 0;
} else if ($a[\'start\'] < $b[\'start\']) {
return -1;
} else {
return 1;
}
');
usort($tmparray, $fCmpSegments);
// push segments to master array
array_push($aSegmSearch['resultsegments'], $tmparray);
}
//mysfLog::log($this, "DEBUG: " . print_r($aSegmSearch['resultsegments'], true));
$this->results = $unique;
break;
default:
throw new Exception("Bad value for app_defaults_segm_search_aggregation_algo: " . sfConfig::get('app_defaults_segm_search_aggregation_algo', 0));
break;
}
} else {
// segmented search enabled
// nothing to do, normal search
}
// segmented search enabled
// not used in _result.php
// $this -> distances = smintSmafeHelper::getDistances($this -> results);
$this->files = $this->queryMetadataDatabase($this->results);
//mysfLog::log($this, "DEBUG: " . print_r($this -> files, true));
// depending on whether it is an upload or not
if ($bUploadedFile) {
//tracknr is before underscore in filename
$fileNameParts = explode("_", $filename);
$tracknr = $fileNameParts[0];
$uploadedFileURL = _compute_public_path($filename, 'uploads/mp3uploads', 'mp3', false);
//url_for("getAudioFile/download") . "?uploaded=" . rawurlencode($filename);
// the url for getting the file via PHP, but incomplete. Format parameter is missing and will be
// appended in mp3 helper class
$uploadedFilePHPUrl_incomplete = url_for("getAudioFile/download", true) . "?uploaded=" . rawurlencode(basename($filename));
if ($aSegmSearch['enabled']) {
$seedLabel = intval(($aSegmSearch['endSegment'] - $aSegmSearch['startSegment']) / 1000) . " seconds from {$originalFilename}";
if ($bMDsearch) {
$seedlabel_topleft = "Seed track, results filtered by " . $metadataquery;
} else {
$seedlabel_topleft = "Seed track";
}
} else {
$seedLabel = $originalFilename;
if ($bMDsearch) {
$seedlabel_topleft = "Seed track, results filtered by " . $metadataquery;
} else {
$seedlabel_topleft = "Seed track";
}
}
} else {
$queryFileMetadata = FiledescPeer::retrieveByPk($tracknr);
$fileInfoName = $queryFileMetadata->getTitle() . " - " . $queryFileMetadata->getPerformers();
$uploadedFilePHPUrl_incomplete = url_for("getAudioFile/download", true) . "?tracknr=" . rawurlencode($tracknr);
$uploadedFileURL = smintUploadFileHelper::getDirectFileUrl($fileForSearchSimilar->getUri());
$seedLabel = $fileInfoName;
if ($bMDsearch) {
$seedlabel_topleft = "Acoustic similarity, filtered by " . $metadataquery;
} else {
$seedlabel_topleft = "Acoustic similarity";
}
}
return $this->renderPartial('search/result', array('render' => 'related', 'id_prefix' => "id_prefix", 'tracknr' => $tracknr, 'uploadedFilePHPUrl_incomplete' => $uploadedFilePHPUrl_incomplete, 'uploadedFileURL' => $uploadedFileURL, 'files' => $this->files, 'queryTrackIsUploaded' => true, 'seedLabel' => $seedLabel, 'limit' => $this->limit, 'metadataquery' => $metadataquery, 'empty_livequery' => $empty_livequery, 'empty_metadatafilteredquery' => $empty_metadatafilteredquery, 'aSegmSearch' => $aSegmSearch, 'seedlabel_topleft' => $seedlabel_topleft));
} catch (Exception $e) {
// an error occoured while trying to query the file
mysfLog::log($this, "STARTING the QUERY failed: " . $e->getMessage());
return $this->renderPartial('search/error', array('error_message' => $e->getMessage()));
}
}
示例8: getMp3PlayerConfig4Seedsong
/** Returns appropriate JS code for Smintplayer embedding for Seed song.
* <p>Note: this function returns more code that the counterpart "getMp3PlayerConfig"
* @param $uploadedFilePHPUrl_incomplete incomplete download url for file. format can be appended
* @param $uploadedFileURL url of original file uploaded (curretnly used as mp3 although this might not be true)
*
*/
public static function getMp3PlayerConfig4Seedsong($uploadedFilePHPUrl_incomplete, $uploadedFileURL)
{
//needed for javascript_tag
use_helper('JavascriptBase');
$player = sfConfig::get('app_mp3player_defaultplayer', 'worldpress');
switch ($player) {
case 'flash-mp3-player':
return 'not implemented';
break;
case 'worldpress':
return 'not implemented';
break;
case 'smintplayer':
default:
if (smintTools::endsWith($uploadedFileURL, "mp3")) {
$audiofile_mp3 = $uploadedFileURL;
$audiofile_ogg = $uploadedFilePHPUrl_incomplete . "&format=ogg";
$orig_ext_comma = "";
$setmedia_orig_part = "";
} elseif (smintTools::endsWith($uploadedFileURL, "ogg")) {
$audiofile_mp3 = $uploadedFilePHPUrl_incomplete . "&format=mp3";
$audiofile_ogg = $uploadedFileURL;
$orig_ext_comma = "";
$setmedia_orig_part = "";
} else {
$audiofile_mp3 = $uploadedFilePHPUrl_incomplete . "&format=mp3";
$audiofile_ogg = $uploadedFilePHPUrl_incomplete . "&format=ogg";
$audiofile_orig = $uploadedFileURL;
$orig_ext = smintTools::getExtension($uploadedFileURL);
$orig_ext_comma = "{$orig_ext},";
$setmedia_orig_part = "{$orig_ext}: \$('#jquery_jplayer_2').jPlayer('option', 'playlist')[0].audiofile_orig,";
}
// get configuration
$playerConfig = sfConfig::get('app_mp3player_smintplayer');
// build options array of array. First dimension is list of files, second is assoc array with values for the player
$options = array();
if (!isset($aSegmSearch['enabled'])) {
$aSegmSearch['enabled'] = false;
}
$protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0;
$hostname = $_SERVER['SERVER_ADDR'];
$port = $_SERVER['SERVER_PORT'];
$server = $protocol . $hostname . ":" . $port;
$tmparray = array('text' => '', 'audiofile_mp3' => $audiofile_mp3, 'audiofile_ogg' => $audiofile_ogg, 'audiofile_orig' => isset($audiofile_orig) && $audiofile_orig ? $audiofile_orig : "not used", 'waveformimage' => $uploadedFilePHPUrl_incomplete . "&format=png", 'duration' => '', 'segments' => $aSegmSearch['enabled'] ? $aSegmSearch['resultsegments'][$i] : array());
// we cannot put all these fields into one array since the output format must be like
// , A: XXXX, B: XXX
// and not
//, {A: XXXX, B: XXX}
$options[] = $tmparray;
$playlist_part = ", playlist: " . smintTools::my_options_for_javascript($options) . ", waveform_resolution: " . intval(sfConfig::get('app_defaults_waveform_resolution')) . ', waveform_factor: ' . doubleval(sfConfig::get('app_defaults_waveform_factor'));
$general_part = "\n\t\t\t\tready: function () {\n\t\t\t\t\t\$(this).jPlayer('setMedia', {\n\t\t\t\t\t\t{$setmedia_orig_part}\n\t\t\t\t\t\tmp3: \$('#jquery_jplayer_2').jPlayer('option', 'playlist')[0].audiofile_mp3,\n\t\t\t\t\t\toga: \$('#jquery_jplayer_2').jPlayer('option', 'playlist')[0].audiofile_ogg\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tplay: function() { // To avoid both jPlayers playing together.\n\t\t\t\t\t\$(this).jPlayer('pauseOthers');\n\t\t\t\t},\n\t\t\t\tswfPath: ' " . _compute_public_path('', 'smintplayer/js', '', false) . "' ,\n\t\t\t\tsupplied: '{$orig_ext_comma} mp3, oga',\n\t\t\t\tsolution: 'flash, html', \n\t\t\t\tcssSelectorAncestor: '#jp_container_2',\n\t\t\t\twmode: 'window',\n\t\t\t\tpreload: 'auto'\n\t\t\t\t" . $playlist_part;
return $general_part;
break;
}
}
示例9: lw_media
function lw_media($name = '', $path = '', $options = array())
{
return lw_link($name, _compute_public_path($path, '', '', true), $options);
}
示例10: image_path
/**
* Returns the path to an image asset.
*
* <b>Example:</b>
* <code>
* echo image_path('foobar');
* => /images/foobar.png
* </code>
*
* <b>Note:</b> The asset name can be supplied as a...
* - full path, like "/my_images/image.gif"
* - file name, like "rss.gif", that gets expanded to "/images/rss.gif"
* - file name without extension, like "logo", that gets expanded to "/images/logo.png"
*
* @param string $source asset name
* @param bool $absolute return absolute path ?
*
* @return string file path to the image file
* @see image_tag
*/
function image_path($source, $absolute = false)
{
return _compute_public_path($source, sfConfig::get('sf_web_images_dir_name', 'images'), 'png', $absolute);
}
示例11: image_path
/**
* Returns the path to an image asset.
*
* <b>Example:</b>
* <code>
* echo image_path('foobar');
* => /images/foobar.png
* </code>
*
* <b>Note:</b> The asset name can be supplied as a...
* - full path, like "/my_images/image.gif"
* - file name, like "rss.gif", that gets expanded to "/images/rss.gif"
* - file name without extension, like "logo", that gets expanded to "/images/logo.png"
*
* @param string $source asset name
* @param bool $absolute return absolute path ?
*
* @return string file path to the image file
* @see image_tag
*/
function image_path($source, $absolute = false, $override = false)
{
// CHANGE TO SYMFONY'S ASSETHELPER
if (!$override && sfConfig::get('app_amazon_enable_s3')) {
$source = ImageTable::generateS3Url($source);
}
return _compute_public_path($source, 'images', 'png', $absolute);
}
示例12: setFeedEnclosure
public function setFeedEnclosure($enclosure = null)
{
if ($enclosure instanceof FeedEnclosure) {
$this->enclosure = $enclosure;
return $enclosure;
}
$type = $enclosure == null ? 'web' : $enclosure;
$params = array();
switch ($type) {
case 'web':
$params['url'] = $this->getWebUrl();
// fixme this should return webloc not local path REGRESSION
$params['length'] = $this->getSize();
$params['mimeType'] = $this->getMimeType();
break;
case 'magnet':
$params['url'] = $this->getMagnet();
$params['length'] = $this->getSize();
$params['mimeType'] = $this->getMimeType();
break;
case 'torrent':
$params['url'] = _compute_public_path($this->getFile() . '.torrent', 'uploads', '', true);
$params['length'] = filesize($this->getTorrentPath());
$params['mimeType'] = 'application/x-bittorrent';
break;
default:
throw new limeException('enclosure', "Unsupported enclosure type {$type}");
}
$this->enclosure = new sfFeedEnclosure();
return $this->enclosure->initialize($params);
}
示例13: include_partial
" method="POST" enctype="multipart/form-data">
<table>
<?php
include_partial('torrent/torrentform', array('form' => $form));
?>
<tr>
<td> </td>
<td colspan="2">
<input type="submit" value="Save"/>
</td>
</tr>
</table>
</form>
<script type="text/javascript">
var add_url = '<?php
echo url_for('torrent/add');
?>
';
var csrf_token = '<?php
echo _compute_public_path($form->getDefault('_csrf_token'), 'json-cache', 'json');
?>
';
$('torrent_<?php
echo $form->getDefault('feed_id');
?>
').observe('submit', sideload);
</script>
</div>
示例14: include_title
<html>
<head>
<?php include_title() ?>
<?php include_stylesheets() ?>
<!--[if IE]>
<?php echo stylesheet_tag(_compute_public_path('sfControlPanelPlugin/css/ie', '.', 'css')) ?>
<![endif]-->
</head>
<body>
<div id="header">
<?php include_component('sfControlPanel', 'header') ?>
</div>
<div id="sidebar">
<?php if(has_slot('sidebar')): ?>
<?php include_slot('sidebar') ?>
<?php else: ?>
<?php include_component('sfControlPanel', 'dataSidebar') ?>
<?php endif; ?>
</div>
<div id="main">
<?php echo $sf_data->getRaw('sf_content') ?>
</div>
</body>
</html>
示例15: include_http_metas
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<?php
include_http_metas();
?>
<?php
include_metas();
?>
<?php
include_title();
?>
<link rel="shortcut icon" type="image/png" href="<?php
echo _compute_public_path('genghis', 'images', 'png');
?>
" />
<?php
include_less_stylesheets();
?>
<?php
include_javascripts();
?>
</head>
<body>
<div class="wrapper">
<?php
include_component_slot('menu');
?>
<div class="container">
<?php