本文整理汇总了PHP中Asset::GetAssetUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Asset::GetAssetUrl方法的具体用法?PHP Asset::GetAssetUrl怎么用?PHP Asset::GetAssetUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Asset
的用法示例。
在下文中一共展示了Asset::GetAssetUrl方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_sendmusic
/**
* Smarty {sendmusic} function plugin
*
* Type: function<br>
* Name: sendmusic<br>
* Purpose: "送歌"按钮, 连同脚本过程及对话框
*
* @author XU Jian <xujianmac@gmail.com>
* @param array
* @param Smarty
*
*/
function smarty_function_sendmusic($params, &$smarty)
{
global $current_user_id;
$number = $params['number'];
if (!isset($number)) {
$smarty->trigger_error('Smarty plugin confirm error: parameter "number" expected.');
}
$title = $params['title'];
if (!isset($title)) {
$title = '(未知)';
}
$artist = $params['artist'];
if (!isset($artist)) {
$artist = '(未知)';
}
$method = $params['method'];
if (!isset($method) || $method == '') {
$method = 'light';
}
//送歌的link文字
$text = isset($params['text']) ? $params['text'] : '';
//送歌的css class
$cssclass = isset($params['class']) ? $params['class'] : '';
$oncomplete = $params['oncomplete'];
if (!isset($oncomplete) || $oncomplete == '') {
$oncomplete = 'void(0);';
}
$html = Template::RequireJsCode('<link href="' . Asset::GetAssetUrl('/css/components/matchbox.css') . '" rel="stylesheet" type="text/css" />');
$html .= "<a title=\"送歌\" href=\"javascript:void(0);\" onclick=\"__openSendMusicDialog('{$number}', '{$title}', '{$artist}')\" class=\"{$cssclass}\">{$text}</a>";
$script = <<<EOF
<script type="text/javascript">
function __openSendMusicDialog(number, title, artist){
\t\$('#sendmusic-dialog').dialog({title: '送歌'});
\t\$('#jquery-interactive-box form input[name="music_id"]').val(number);
\t\$('#jquery-interactive-box .song-title').text(title);
\t\$('#jquery-interactive-box .song-artist').text(artist);
\t\$('#jquery-interactive-box .matchbox').matchbox({name: 'friend_id', userid: {$current_user_id}});
\t\$('#jquery-interactive-box form input.default').unbind('click');
\t\$('#jquery-interactive-box form').ajaxForm({
\t\tbefroeSumit: function(){
\t\t\tif(!\$('#jquery-interactive-box form input[name="friend_id"]').val()){
\t\t\t\talert('请选择朋友');
\t\t\t\treturn false
\t\t\t}
\t\t},
\t\tsuccess: function(r){
\t\t\tif(r.substr(0,1)=='0'){
\t\t\t\t\$('#jquery-interactive-box').hide();
\t\t\t\t\$.alert('送出了一首歌');
\t\t\t}else{
\t\t\t\talert(r.substr(2));
\t\t\t\t\$(this).attr('disabled', false);
\t\t\t}
\t\t}
\t});
}
</script>
EOF;
$script = Template::RequireJsCode($script);
Template::ScriptHolder('', $script);
$html_dialog = '<div id="sendmusic-dialog" style="display:none;">';
$html_dialog .= Template::Render('section/music_send_user.tpl');
$html_dialog .= '</div>';
$html_dialog = Template::RequireJsCode($html_dialog);
Template::ScriptHolder('', $html_dialog);
$script = Template::RequireJs('/scripts/jquery.matchbox.js');
$script .= Template::RequireJs('/scripts/jquery.peoplepicker.js');
Template::ScriptHolder('', $script);
return $html;
}
示例2: smarty_block_jsholder
/**
* Smarty {js} block plugin
*
* Name: js<br>
* Purpose: 提供js合并去重功能
* @link
* @author Yancan <yancan@staff.139.com>
* @param array
* @param Smarty
*
*/
function smarty_block_jsholder($params, $content, &$smarty, &$repeat)
{
if ($repeat) {
return;
}
static $cont = array();
$output = (isset($params['output']) and $params['output']);
if ($output) {
if (empty($cont)) {
return '';
}
if (ASSET_COMBO) {
$url = "'" . Asset::GetComboUrl(array_keys($cont)) . "'";
} else {
$js = array();
foreach ($cont as $key => $value) {
$js[] = Asset::GetAssetUrl($key);
}
$url = json_encode($js);
}
return $url;
}
if (empty($content)) {
return '';
}
foreach (explode("\n", $content) as $v) {
if (empty($v)) {
continue;
}
$v = trim($v);
$v = ltrim($v, '/');
$cont[$v] = 1;
}
}
示例3: smarty_block_quickedit
/**
* Smarty {quikedit} function plugin
*
* Type: function<br>
* Name: quikedit<br>
* Date: Mon. Sep 15, 2008<br>
* Purpose: eidt-in-place效果, 直接编辑页内的文本内容(类似flickr.com的直接编辑照片标题、照片说明并保存)
* Examples: <{quikedit target="#phototitle"}>
* Output: <div id='phototitle-quickedit'>
<script .....>
* @link
* @author 许健
* @version 1.0
* @param array
* @param Smarty
* @return HTML to render the quikedit front-end component
*
*/
function smarty_block_quickedit($params, $content, &$smarty, &$repeat)
{
if (!$repeat) {
$target = $params['target'];
if (!isset($target)) {
$smarty->trigger_error('Smarty plugin "quickedit" error: parameter "target" expected.');
}
if (strpos($target, '#') == 0) {
$target = substr($target, 1);
}
$action = $params['action'];
if (!isset($action)) {
$smarty->trigger_error('Smarty plugin "quickedit" error: parameter "action" expected.');
}
$name = $params['name'];
if (!isset($name)) {
$name = 'content';
}
$maxlength = $params['maxlength'];
$scale = $params['scale'];
// may be: input, single, multiple, textarea
if (!isset($scale)) {
$scale = 'text';
}
$oncomplete = $params['oncomplete'];
$html .= '<div id="' . $target . '-quickedit" class="quickedit" style="display:none;">';
$html .= '<form id="' . $target . '-quickedit-form" name="' . $target . '-form" method="POST" action="' . $action . '">';
$html .= '<input type="hidden" name="ajax" value="1" /> ';
$html .= $content;
// 写入需要追加的input type=hidden
if (in_array($scale, array('multiple', 'textarea'))) {
$html .= '<textarea id="' . $target . '-quickedit-content" name="' . $name . '" class="edit" maxlength="' . $maxlength . '"></textarea>';
} else {
$html .= '<input id="' . $target . '-quickedit-content" name="' . $name . '" class="edit" maxlength="' . $maxlength . '" value="" autocomplete="off" />';
}
$html .= '<div class="buttons">';
$html .= '<div class="floatright error" id="' . $target . '-quickedit-error"></div> ';
$html .= '<input type="submit" id="' . $target . '-quickedit-submit" value="确定" class="default" /> ';
$html .= '<a id="' . $target . '-quickedit-cancel" href="cancel" />取消</a>';
$html .= '</div>';
$html .= '</form>';
$html .= '</div>';
$script .= '<script type="text/javascript" src="' . Asset::GetAssetUrl('/lib/jquery/jquery.form.js') . '"></script>';
$script .= '<script type="text/javascript" src="' . Asset::GetAssetUrl('/scripts/jquery.quickedit.js') . '"></script>';
$script .= '<script type="text/javascript">';
$script .= '$(\'#' . $target . '\').quickedit({action:\'' . $action . '\'';
if (isset($oncomplete)) {
$script .= ', oncomplete: function(){eval(\'' . $oncomplete . '\');}';
}
$script .= '});';
$script .= '</script>';
Template::ScriptHolder('', $script);
return $html;
}
}
示例4: smarty_function_audioplayer
/**
* Smarty {audioplayer} function plugin
*
* Type: function<br>
* Name: audioplayer<br>
* Date: Sat. Nov 12, 2008<br>
* Purpose: 外观一致的音乐播放器, 使用WordPress plugin: audio player
* Examples: <{audioplayer url="http://...."}>
* @link
* @author 许健
* @version 1.0
* @param array
* @param Smarty
* @return HTML to render the audio player front-end component
*
*/
function smarty_function_audioplayer($params, &$smarty)
{
$name = $params['name'];
if (!isset($name)) {
$smarty->trigger_error('Smarty plugin audioplayer error: parameter "name" expected.');
}
$url = $params['url'];
if (!isset($url)) {
$smarty->trigger_error('Smarty plugin audioplayer error: parameter "url" expected.');
}
$titles = $params['titles'];
$artists = $params['artists'];
$autostart = $params['autostart'];
if (in_array($autostart, array('yes', 'true', '1'))) {
$autostart = 'yes';
} else {
$autostart = 'no';
}
$loop = $params['loop'];
if (in_array($loop, array('false', 'no', '0'))) {
$loop = 'no';
} else {
$loop = 'yes';
}
$width = $params['width'];
if (!isset($width)) {
$width = 200;
}
$html = Template::RequireJs('/lib/audioplayer.js');
$html .= '<script type="text/javascript">AudioPlayer.setup("' . Asset::GetAssetUrl('/lib/audioplayer.swf') . '", { width: ' . $width . ' }); </script>';
$html .= '<script type="text/javascript">';
$html .= "AudioPlayer.embed('audioplayer-{$name}', {soundFile: '{$url}', titles: '{$titles}', artists: '{$artists}', autostart: '{$autostart}', loop: '{$loop}'}); ";
$html .= '</script>';
Template::ScriptHolder('', $html);
return '<div id="audioplayer-' . $name . '"></div>';
//$html;
}
示例5: smarty_function_matchbox
/**
* Smarty {matchbox} function plugin
*
* Type: function<br>
* Name: matchbox<br>
* Date: Tue. Sep 9, 2008<br>
* Purpose: 显示一个“姓名查询器”, 输入汉字、汉语拼音关键字, 向后端查询好友姓名, 显示下拉菜单并可选择输入
* Examples: <{matchbox name="recipients"}>
* Output: <script src=..... />
<link type=.... />
* <div class="matchbox">
<input type="hidden" name="recipients" />
</div>
* <script ....></script>
* @link
* @author 许健
* @version 1.0
* @param array
* @param Smarty
* @return HTML to render the matchbox front-end component
*
* history:
Thu. 2008-11-13 许健 + People Picker
*/
function smarty_function_matchbox($params, &$smarty)
{
$name = $params['name'];
if (!isset($name)) {
$smarty->trigger_error('Smarty plugin sprite error: parameter "name" expected.');
}
$userid = $params['userid'];
if (!isset($userid)) {
$smarty->trigger_error('Smarty plugin sprite error: parameter "userid" expected.');
}
if (!isset($params['groupid'])) {
$groupid = 0;
} else {
$groupid = $params['groupid'];
}
$limit = $params['limit'];
$width = $params['width'];
if (!isset($width) || $width == '') {
$width = '400';
}
$exclude = $params['exclude'];
$height = $params['height'];
if (!isset($height) || $height == '') {
$height = '18';
}
$paging = $params['paging'];
if (!isset($paging) || $paging == '') {
$paging = 'true';
}
$layout = $params['layout'];
$queryurl = $params['queryurl'];
$filter = $params['filter'];
// group, online...
$html = '<link href="' . Asset::GetAssetUrl('/css/components/matchbox.css') . '" rel="stylesheet" type="text/css" />';
$htlm .= "\n";
$html .= '<div title="请输入好友姓名,支持全拼、中文、首字母模糊输入" class="floatleft" style="width:' . $width . 'px"><div id="jquery-matchbox-' . $name . '" class="matchbox"></div></div>';
$script .= '<script type="text/javascript" src="' . Asset::GetAssetUrl('/scripts/jquery.matchbox.js') . '"></script>';
$script .= "\n";
$script .= '<script type="text/javascript" src="' . Asset::GetAssetUrl('/scripts/jquery.peoplepicker.js') . '"></script>';
$script .= "\n";
$script .= '<script type="text/javascript">';
$script .= '$(\'#jquery-matchbox-' . $name . '\').matchbox({name: "' . $name . '", userid:"' . $userid . '", groupid:"' . $groupid . '"';
if (isset($limit) && is_numeric($limit)) {
$script .= ', limit: ' . $limit;
}
if (isset($layout) && $layout == 'floating') {
$script .= ', layout: "floating"';
}
if (isset($exclude)) {
$script .= ', exclude: "' . $exclude . '"';
}
if (isset($filter)) {
$script .= ', filter: "' . $filter . '"';
}
if (isset($filter)) {
$script .= ', paging: "' . $paging . '"';
}
if (isset($queryurl)) {
$script .= ', queryUrl: "' . $queryurl . '"';
}
$script .= '});';
$script .= '</script>';
$script .= "\n";
Template::ScriptHolder('', $script);
return $html;
}
示例6: JsToString
/**
* 生成 <script ...></script>
*
* @param array $js
* @param boolean $mtime
* @return string
* @see Asset::GetAssetUrl()
*/
public static function JsToString(array $js, $mtime = true)
{
if (empty($js)) {
return '';
}
$cnt = count($js);
if (ASSET_COMBO) {
$str = '<script type="text/javascript" src="' . ($cnt > 1 ? Asset::GetComboUrl($js, $mtime) : Asset::GetAssetUrl($js[0], $mtime)) . '"></script>';
} else {
$str = '';
for ($i = 0; $i < $cnt; ++$i) {
$str .= '<script type="text/javascript" src="' . Asset::GetAssetUrl($js[$i], $mtime) . "\"></script>\n";
}
}
return $str;
}
示例7: smarty_modifier_formaturl
/**
* Smarty formaturl modifier plugin
*
* Type: modifier<br>
* Name: formaturl<br>
* Date: JUNE 11, 2008
* Purpose: Format url as purpose
* Input: string to format
* Example: {$var|formaturl}
* @version 1.0
* @param (String) $url | 要格式化的网址
* @param (Boolean) $mtime | 可选,文件创建时间
* @return (String) 格式化后的网址
*/
function smarty_modifier_formaturl($url, $mtime = true, $type = 1)
{
return Asset::GetAssetUrl($url, $mtime, $type);
}
示例8: smarty_function_privacee
/**
* Smarty {privacee} function plugin
*
* Type: function<br>
* Name: privacee<br>
* Purpose:
* @link
* @author 许健 (xujianmac@gmail.com)
* @param array
* @param Smarty
*
*/
function smarty_function_privacee($params, &$smarty)
{
$link = $params['link'];
if (!isset($link)) {
$smarty->trigger_error('Smarty plugin privacee error: parameter "link" expected.');
}
$origin = $params['origin'];
if (!isset($origin)) {
$origin = 'null';
}
$oncomplete = $params['oncomplete'];
if (!isset($oncomplete) || $oncomplete == '') {
$oncomplete = 'function(){ return;}';
} else {
if (strchr($oncomplete, '(') || strchr($oncomplete, 'return')) {
$oncomplete = 'function(){' . $oncomplete . '}';
}
}
$onengage = $params['onengage'];
if (strchr($onengage, '(') || strchr($onengage, 'return')) {
$onengage = 'function(){' . $onengage . '}';
}
$ondismiss = $params['ondismiss'];
if (strchr($ondismiss, '(') || strchr($ondismiss, 'return')) {
$ondismiss = 'function(){' . $ondismiss . '}';
}
//var_dump($origin);
$onload = $params['onload'];
$onabort = $params['onabort'];
$onerror = $params['onerror'];
$origin = explode(';', $origin);
//var_dump($origin);
$html = '<link href="' . Asset::GetAssetUrl('/css/components/privacy.css') . '" rel="stylesheet" type="text/css" />';
$html .= "\n";
Template::Assign('oringin', $origin);
Template::Assign('oringin_type', $origin[0]);
Template::Assign('oringin_data', $origin[1]);
$html .= Template::Render('section/privacy_setting.tpl');
$html = Template::RequireJsCode($html);
Template::ScriptHolder('', $html);
$script = Template::RequireJs('/lib/jquery/jquery.form.js');
$script .= "\n";
$script .= <<<EOF
<script type="text/javascript">
EOF;
if (isset($onengage)) {
$script .= "\n__privacee__onengage = {$onengage};";
}
if (isset($ondismiss)) {
$script .= "\n__privacee__ondismiss = {$ondismiss};";
}
$script .= <<<EOF
\$('{$link}').click(function(){
\t\$(this).blur();
\tvar p = \$(this).position();
\$('#privacy-spring').show().css('left', p.left + 44).css('top', p.top - 3);
__privacee__onengage.call();
\t__privacee__oncomplete = {$oncomplete};
\twindow.setTimeout(function(){
\t\t\$(window).resize(function(){
\t\t\t\$('#privacy-spring').hide();
\t\t});
\t}, 500);
\treturn false;
});
</script>
EOF;
Template::ScriptHolder('', $script);
return '';
}
示例9: GetUrlByName
/**
* 根据 file_id ,获取一个/一组文件的访问地址
* @param int/array $id file
* @param string $thumb
*/
public static function GetUrlByName($file_info, $thumb = '48x48', $type = 'avatar', $reg = 1)
{
if (is_numeric($file_info)) {
return Asset::GetAssetUrl('/images/red.jpg');
}
list($user_id, $file_name) = explode('_', $file_info, 2);
if (empty($user_id) || empty($file_name)) {
return Asset::DefaultUrl(0, $thumb, '', $reg);
}
if (0 == strncmp($file_name, 'http://', 7)) {
return $file_name;
/*$size = getimagesize($file_name);
if(false===$size || !is_array($size) || empty($size))
return JWAsset::DefaultUrl(0, $thumb);*/
/*if(file_get_contents($file_name))
return $file_name;
else*/
}
$file_path = join('/', array('/system', $type, $user_id, $thumb, $file_name));
return Asset::GetUploadUrl($file_path);
}