本文整理汇总了PHP中URL::to_asset方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::to_asset方法的具体用法?PHP URL::to_asset怎么用?PHP URL::to_asset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URL
的用法示例。
在下文中一共展示了URL::to_asset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testToAssetGeneratesURLWithoutFrontControllerInURL
/**
* Test the URL::to_asset method.
*
* @group laravel
*/
public function testToAssetGeneratesURLWithoutFrontControllerInURL()
{
$this->assertEquals('http://localhost/image.jpg', URL::to_asset('image.jpg'));
$this->assertEquals('https://localhost/image.jpg', URL::to_asset('image.jpg', true));
Config::set('application.index', '');
$this->assertEquals('http://localhost/image.jpg', URL::to_asset('image.jpg'));
$this->assertEquals('https://localhost/image.jpg', URL::to_asset('image.jpg', true));
Request::foundation()->server->add(array('HTTPS' => 'on'));
$this->assertEquals('https://localhost/image.jpg', URL::to_asset('image.jpg'));
}
示例2: assetPath
function assetPath($url)
{
$url = asset($url);
$base = rtrim(\URL::to_asset(''), '/') . '/';
if (S::unprefix($url, $base)) {
if (strtok($url, '/') === 'bundles') {
$bundle = strtok('/');
$path = strtok(null);
return \Bundle::path($bundle) . 'public' . DS . ltrim($path, '\\/');
} else {
return \path('public') . ltrim($url, '\\/');
}
}
}
示例3: __
<tr>
<th><?php
echo __('tinyissue.image');
?>
</th>
<td>
<input type="file" value="<?php
echo Input::old('image');
?>
" name="image" /><br/><br/>
<img height="50px" src="<?php
if (Project::current()->image != '') {
echo URL::to_asset(Project::current()->image);
} else {
echo URL::to_asset('uploads/project/projectDefault.png');
}
?>
" />
</td>
</tr>
<tr>
<th><?php
echo __('tinyissue.status');
?>
</th>
<td><?php
echo Form::select('status', array(1 => 'Open', 0 => 'Archived'), Project::current()->status);
?>
</td>
示例4: render
<?php
echo render('includes.header');
echo render('includes.navbar');
?>
<div class="container" id="content">
<div class="row">
<div class="span">
<div class="image-place" style="display:none">
<div class="image-holder">
<img src="<?php
echo URL::to_asset('images/' . $galleryID . '/' . $image->name);
?>
">
</div>
<div class="image-bar">
<div class="image-stat"><i class="icon-eye-open"></i> <?php
echo $image->views;
?>
</div>
<div class="image-stat"><i class="icon-heart"></i> <?php
echo $image->likes;
?>
</div>
<div class="pull-right">
<?php
if ($liked) {
?>
<button class="btn btn-danger" type="button" disabled><i class="icon-heart icon-white"></i> Liked!</button>
示例5: fetch_modpack
private function fetch_modpack($slug)
{
$response = array();
if (Cache::has('modpack.' . $slug) && empty($this->client)) {
$modpack = Cache::get('modpack.' . $slug);
} else {
$modpack = Modpack::with('Builds')->where("slug", "=", $slug)->first();
if (empty($this->client)) {
Cache::put('modpack.' . $slug, $modpack, 5);
}
}
if (empty($modpack)) {
return array("error" => "Modpack does not exist");
}
$response['name'] = $modpack->slug;
$response['display_name'] = $modpack->name;
$response['url'] = $modpack->url;
$resourcePath = URL::to_asset('resources/' . $modpack->slug);
if ($modpack->icon == 0 && !empty($modpack->icon_md5)) {
$response['icon'] = Config::get('solder.mirror_url') . $modpack->slug . "/resources/icon.png";
} else {
if ($modpack->icon == 0 && empty($modpack->icon_md5)) {
$response['icon'] = URL::to_asset('resources/default/icon.png');
$modpack->icon_md5 = md5_file(path('public') . 'resources/default/icon.png');
} else {
if (Config::get('solder.use_s3')) {
$response['icon'] = Config::get('solder.s3_url') . 'resources/' . $modpack->slug . '/icon.png?' . TimeUtils::getTimestampDate($modpack->updated_at);
} else {
$response['icon'] = $resourcePath . "/icon.png";
}
}
}
$response['icon_md5'] = $modpack->icon_md5;
if ($modpack->logo == 0 && !empty($modpack->logo_md5)) {
$response['logo'] = Config::get('solder.mirror_url') . $modpack->slug . "/resources/logo.png";
} else {
if ($modpack->logo == 0 && empty($modpack->logo_md5)) {
$response['logo'] = URL::to_asset('resources/default/logo.png');
$modpack->logo_md5 = md5_file(path('public') . 'resources/default/logo.png');
} else {
if (Config::get('solder.use_s3')) {
$response['logo'] = Config::get('solder.s3_url') . 'resources/' . $modpack->slug . '/logo.png?' . TimeUtils::getTimestampDate($modpack->updated_at);
} else {
$response['logo'] = $resourcePath . "/logo.png";
}
}
}
$response['logo_md5'] = $modpack->logo_md5;
if ($modpack->background == 0 && !empty($modpack->background_md5)) {
$response['background'] = Config::get('solder.mirror_url') . $modpack->slug . "/resources/background.png";
} else {
if ($modpack->background == 0 && empty($modpack->background_md5)) {
$response['background'] = URL::to_asset('resources/default/background.png');
$modpack->background_md5 = md5_file(path('public') . 'resources/default/background.png');
} else {
if (Config::get('solder.use_s3')) {
$response['background'] = Config::get('solder.s3_url') . 'resources/' . $modpack->slug . '/background.png?' . TimeUtils::getTimestampDate($modpack->updated_at);
} else {
$response['background'] = $resourcePath . "/background.png";
}
}
}
$response['background_md5'] = $modpack->background_md5;
$response['recommended'] = $modpack->recommended;
$response['latest'] = $modpack->latest;
$response['builds'] = array();
foreach ($modpack->builds as $build) {
if ($build->is_published) {
if (!$build->private) {
array_push($response['builds'], $build->version);
} else {
if (isset($this->client)) {
foreach ($this->client->modpacks as $pmodpack) {
if ($modpack->id == $pmodpack->id) {
array_push($response['builds'], $build->version);
}
}
}
}
}
}
return $response;
}
示例6: image
/**
* Create a HTML image input element.
*
* <code>
* // Create an image input element
* echo Form::image('img/submit.png');
* </code>
*
* @param string $url
* @param string $name
* @param array $attributes
* @return string
*/
public static function image($url, $name = null, $attributes = array())
{
$attributes['src'] = URL::to_asset($url);
return static::input('image', $name, null, $attributes);
}
示例7:
?>
<style>
body {
padding-top: 60px;
padding-bottom: 20px;
}
</style>
<?php
echo HTML::style('css/bootstrap-responsive.css');
?>
<?php
echo HTML::style('css/juballery.css');
?>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Fav and touch icons -->
<?php
echo HTML::script('js/jquery.js');
?>
<?php
echo HTML::script('js/bootstrap.js');
?>
<link rel="shortcut icon" href="<?php
echo URL::to_asset('favicon.ico');
?>
">
</head>
<body>
示例8: show
/**
* Return the URL to the asset route container.
*
* @param string $route
* @return string
*/
public static function show($route)
{
$methods = array('css' => 'style', 'js' => 'script');
// If the container is set to development mode then Basset will show all the assets that have been added
// up until now. This may be a problem if assets are added after the template view is rendered, however
// this is acceptable. Assets should be added as early as possible during the application logic.
$container = static::$routes[Bundle::option('basset', 'handles') . '/' . $route];
if ($container->config->get('development')) {
$response = '<!-- BASSET NOTICE: Some assets may not be displayed depending on where they were set during the application flow. -->';
return $response . PHP_EOL . $container->compile();
}
return HTML::$methods[File::extension($route)](URL::to_asset(Bundle::option('basset', 'handles') . '/' . $route));
}
示例9:
</div>
<?php
}
?>
<div class="container" id="content">
<?php
echo Section::yield('content');
?>
</div>
<script>
var dojoConfig = {
async: 1,
baseUrl: "<?php
echo URL::to_asset('js/dojo');
?>
",
packages: [
{ name: "bootstrap", location: "Dojo-Bootstrap" },
{ name: "clementia", location: "clementia" }
]
};
</script>
<?php
echo Asset::container('footer')->scripts();
?>
<?php
echo Section::yield('additional_footer_content');
?>
示例10: get_excluded_tags
}
/**
* Gets an array of tages to be excluded from
* the elcude param
* @param int $exclude What to gets excluded from i.e. SBBCodeParser_BBCode::AUTO_DETECT_EXCLUDE_EMOTICON
* @return array
*/
private function get_excluded_tags($exclude)
{
$ret = array();
foreach ($this->bbcodes as $bbcode) {
if ($bbcode->auto_detect_exclude() & $exclude) {
$ret[] = $bbcode->tag();
}
}
return $ret;
}
}
IoC::singleton('BBCodeDocParser', function () {
$instance = new SBBCodeParser_Document();
$instance->add_emoticons(array(":)" => URL::to_asset('bundles/forums/emoticons/smile.png'), "=)" => URL::to_asset('bundles/forums/emoticons/smile.png'), "=]" => URL::to_asset('bundles/forums/emoticons/smile.png'), ":angel:" => URL::to_asset('bundles/forums/emoticons/angel.png'), ":angry:" => URL::to_asset('bundles/forums/emoticons/angry.png'), "8-)" => URL::to_asset('bundles/forums/emoticons/cool.png'), ":'(" => URL::to_asset('bundles/forums/emoticons/cwy.png'), "='(" => URL::to_asset('bundles/forums/emoticons/cwy.png'), "='[" => URL::to_asset('bundles/forums/emoticons/cwy.png'), ":ermm:" => URL::to_asset('bundles/forums/emoticons/ermm.png'), ":D" => URL::to_asset('bundles/forums/emoticons/grin.png'), "=D" => URL::to_asset('bundles/forums/emoticons/grin.png'), "<3" => URL::to_asset('bundles/forums/emoticons/heart.png'), ":(" => URL::to_asset('bundles/forums/emoticons/sad.png'), ":O" => URL::to_asset('bundles/forums/emoticons/shocked.png'), ":P" => URL::to_asset('bundles/forums/emoticons/tongue.png'), "=(" => URL::to_asset('bundles/forums/emoticons/sad.png'), "=[" => URL::to_asset('bundles/forums/emoticons/sad.png'), "=O" => URL::to_asset('bundles/forums/emoticons/shocked.png'), "=P" => URL::to_asset('bundles/forums/emoticons/tongue.png'), ";)" => URL::to_asset('bundles/forums/emoticons/wink.png'), ":alien:" => URL::to_asset('bundles/forums/emoticons/alien.png'), ":blink:" => URL::to_asset('bundles/forums/emoticons/blink.png'), ":blush:" => URL::to_asset('bundles/forums/emoticons/blush.png'), ":cheerful:" => URL::to_asset('bundles/forums/emoticons/cheerful.png'), ":devil:" => URL::to_asset('bundles/forums/emoticons/devil.png'), ":dizzy:" => URL::to_asset('bundles/forums/emoticons/dizzy.png'), ":getlost:" => URL::to_asset('bundles/forums/emoticons/getlost.png'), ":happy:" => URL::to_asset('bundles/forums/emoticons/happy.png'), ":kissing:" => URL::to_asset('bundles/forums/emoticons/kissing.png'), ":ninja:" => URL::to_asset('bundles/forums/emoticons/ninja.png'), ":pinch:" => URL::to_asset('bundles/forums/emoticons/pinch.png'), ":pouty:" => URL::to_asset('bundles/forums/emoticons/pouty.png'), ":sick:" => URL::to_asset('bundles/forums/emoticons/sick.png'), ":sideways:" => URL::to_asset('bundles/forums/emoticons/sideways.png'), ":silly:" => URL::to_asset('bundles/forums/emoticons/silly.png'), ":sleeping:" => URL::to_asset('bundles/forums/emoticons/sleeping.png'), ":unsure:" => URL::to_asset('bundles/forums/emoticons/unsure.png'), ":woot:" => URL::to_asset('bundles/forums/emoticons/w00t.png'), ":wassat:" => URL::to_asset('bundles/forums/emoticons/wassat.png')));
return $instance;
});
class BBCodeParser
{
public static function parse($elements)
{
$parser = IoC::resolve('BBCodeDocParser');
return $parser->parse($elements)->detect_links()->detect_emails()->detect_emoticons()->get_html();
}
}
示例11:
<!doctype html>
<html>
<head>
<title>Flickr Search Results</title>
<link rel="stylesheet" href="<?php
echo URL::to_asset('css/default.css');
?>
">
</head>
<body>
<p>You searched for: <?php
echo $search_term;
?>
</p>
<div id="results">
<?php
foreach ($results as $photo) {
$id = $photo['id'];
$farm = $photo['farm'];
$secret = $photo['secret'];
$server_id = $photo['server'];
$img_src = "http://farm" . $farm . ".staticflickr.com/" . $server_id . "/" . $id . "_" . $secret . "_m.jpg";
echo '<img src="' . $img_src . '" />';
}
?>
</div>
</body>
</html>
示例12:
<div class="image-stat"><i class="icon-eye-open"></i> <?php
echo $gallery->views;
?>
</div>
<b><?php
echo $gallery->name;
?>
</b>
</div>
<div class="image-holder">
<a href="<?php
echo URL::to('home/gallery/' . $gallery->id);
?>
">
<img src="<?php
echo URL::to_asset('images/' . $gallery->id . '/' . $gallery->thumb);
?>
">
</a>
</div>
</div>
</div>
<?php
if ($i % 4 == 0) {
echo '</div><div class="row">';
}
$i++;
}
?>
</div>
示例13:
<link rel="shortcut icon" href="<?php
echo URL::to_asset('img/favicon.png');
?>
">
<!-- styles -->
<link href="<?php
echo URL::to_asset('css/style.css');
?>
?3" rel="stylesheet" type="text/css">
<!-- Js for fonts and tracking -->
<script type="text/javascript" src="http://use.typekit.com/dlj4kfm.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<script type="text/javascript" src="<?php
echo URL::to_asset('js/modernizr-2.5.2.min.js');
?>
"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-23865777-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
示例14:
<meta name="viewport" content="width=device-width,initial-scale=1">
<title><?php
echo Config::get('application.my_bugs_app.name');
?>
</title>
<?php
echo Asset::styles();
?>
</head>
<body>
<div id="container">
<div id="login">
<h1>Welcome to<br><img src="<?php
echo URL::to_asset('app/assets/images/layout/tinyissue.svg');
?>
" alt="<?php
echo Config::get('application.my_bugs_app.name');
?>
" style="width:350px;;"></h1>
<form method="post">
<table class="form" >
<tr>
<td colspan="2" style="color: #a31500;"><?php
echo Session::get('error');
?>
</td>
</tr>
示例15:
?>
">Download <i class="download"></i></a></li>
</ul>
<ul class="social span3 offset2">
<li><a href="http://github.com/laravel"><i class="github"></i> GitHub</a></li>
<li><a href="http://twitter.com/laravelphp"><i class="twitter"></i> Twitter</a></li>
</ul>
</div>
</div>
</footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="<?php
echo URL::to_asset('js/jquery-1.7.1.min.js');
?>
"><\/script>')</script>
<script src="<?php
echo URL::to_asset('js/bootstrap.min.js');
?>
"></script>
<script src="<?php
echo URL::to_asset('js/main-min.js');
?>
"></script>
<script src="<?php
echo URL::to_asset('js/google-code-prettify/prettify.js');
?>
"></script>
<script>$(function(){prettyPrint()})</script>
</body>
</html>