本文整理汇总了PHP中public_path函数的典型用法代码示例。如果您正苦于以下问题:PHP public_path函数的具体用法?PHP public_path怎么用?PHP public_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了public_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: filterLoad
/**
* Filters an asset after it has been loaded.
*
* @param \Assetic\Asset\AssetInterface $asset
* @return void
*/
public function filterLoad(AssetInterface $asset)
{
$max_nesting_level = ini_get('xdebug.max_nesting_level');
$memory_limit = ini_get('memory_limit');
if ($max_nesting_level && $max_nesting_level < 200) {
ini_set('xdebug.max_nesting_level', 200);
}
if ($memory_limit && $memory_limit < 256) {
ini_set('memory_limit', '256M');
}
$root = $asset->getSourceRoot();
$path = $asset->getSourcePath();
$dirs = array();
$lc = new \Less_Parser(array('compress' => true));
if ($root && $path) {
$dirs[] = dirname($root . '/' . $path);
}
foreach ($this->loadPaths as $loadPath) {
$dirs[] = $loadPath;
}
$lc->SetImportDirs($dirs);
$url = parse_url($this->getRequest()->getUriForPath(''));
$absolutePath = str_replace(public_path(), '', $root);
if (isset($url['path'])) {
$absolutePath = $url['path'] . $absolutePath;
}
$lc->parseFile($root . '/' . $path, $absolutePath);
$asset->setContent($lc->getCss());
}
开发者ID:cartalyst,项目名称:assetic-filters,代码行数:35,代码来源:LessphpFilter.php
示例2: getUploadTo
/**
* Get where the file is to be uploaded to
*
* @return mixed
*/
public function getUploadTo($path = '')
{
if (isset($this->options['upload_to'])) {
return $this->options['upload_to'];
}
return public_path($this->addSlashes(self::DEFAULT_UPLOAD_TO)) . $path;
}
开发者ID:nitin-vaghani,项目名称:bumble,代码行数:12,代码来源:FileField.php
示例3: editUser
public function editUser($id, Request $request)
{
$user = User::find($id);
if ($request->has('first')) {
$user->first = $request->input('first');
}
if ($request->has('last')) {
$user->last = $request->input('last');
}
if ($request->has('email')) {
$user->email = $request->input('email');
}
if ($request->has('phone')) {
$user->phone = $request->input('phone');
}
if ($request->hasFile('resume')) {
$request->file('resume')->move(public_path('resumes'), $user->first . '-' . $user->last . '-' . $user->id . '.jpg');
$user->resume = '/resumes/' . $user->first . '-' . $user->last . '-' . $user->id . '.jpg';
}
if ($request->hasFile('headshot')) {
$request->file('headshot')->move(public_path('headshots'), $user->first . '-' . $user->last . '-' . $user->id . '.jpg');
$user->headshot = '/headshots/' . $user->first . '-' . $user->last . '-' . $user->id . '.jpg';
}
if ($request->has('user_type')) {
$user->user_type = $request->input('user_type');
}
$request->session()->flash('success', 'User Updated!');
$user->save();
return view('admin.user-edit', ['user' => $user]);
}
开发者ID:sipplified,项目名称:AuditionAnswer,代码行数:30,代码来源:ManageController.php
示例4: run
public function run()
{
DB::table('home_page')->delete();
$success = File::cleanDirectory($this->getImagesPath());
File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore'));
HomePage::create(['headline' => "Industrial Legacy", 'text' => 'RUSTIC DETAILS. MODERN EDGE. REFINED LIVING IN COURT SQUARE. <br> 1 - 4 BEDROOM HOMES FROM $615K. PENTHOUSES PRICED UPON REQUEST.', 'subtext' => 'CHILDREN\'S PLAYROOM, LOUNGE, LIBRARY, GYM, TERRACE AND PARKING', 'image' => $this->copyImage(public_path() . '/backup_images/building/building.jpg')]);
}
开发者ID:rilence,项目名称:pacificSite,代码行数:7,代码来源:HomePageTableSeeder.php
示例5: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$this->publishes([__DIR__ . '/../assets/ajaxblade.js' => public_path('vendor/ajaxblade/ajaxblade.js')], 'public');
Blade::directive('ajaxpagination', function ($expression) {
return "<?php echo with({$expression})->render() ?>\n <script>\n \$(document).ready(function(){\n \$('ul.pagination:visible:first').hide();\n \$('div.abs').jscroll({\n debug: true,\n autoTrigger: true,\n nextSelector: '.pagination li.active + li a',\n contentSelector: 'div.abs',\n callback: function() {\n \$('ul.pagination:visible:first').hide();\n }\n });\n });\n </script>\n ";
});
}
开发者ID:AbdullahGhanem,项目名称:ajax-blade,代码行数:12,代码来源:AjaxbladeServiceProvider.php
示例6: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
if (Auth::check()) {
# code...
if (Auth::user()->type == 1) {
# code...
$rules = ['activity_id' => 'required|integer', 'event_name' => 'required|unique:events', 'image_path' => 'required|image'];
$validator = Validator::make($request->all(), $rules);
if ($validator->fails()) {
# code...
return redirect()->back()->withErrors($validator);
}
if ($request->hasFile('image_path')) {
$input = $request->all();
$image = $input['image_path'];
$name = '' . $input['event_name'] . '.png';
//dd($name);
$image = $image->move(public_path() . '/images/events/', studly_case($name));
$url = '/images/events/' . studly_case($name);
$event = Event::create(['activity_id' => $input['activity_id'], 'event_name' => $input['event_name'], 'image_path' => $url]);
if ($event) {
# code...
$subscribedUsers = $this->getUsers($event->activity_id);
$this->sendEmail($subscribedUsers, $event->event_name);
Session::flash('eventCreated', $event->event_name . ' has been created!');
} else {
return "error creating the event.";
}
return redirect('home');
}
return redirect('/');
}
}
return redirect('/');
}
开发者ID:a-madhukar,项目名称:Yahya,代码行数:40,代码来源:EventController.php
示例7: updateWelcomeMessage
public function updateWelcomeMessage()
{
$user = User::find(Auth::user()->id);
$data = array('welcome_message' => Input::get('welcome_message'), 'welcome_phone_number' => Input::get('welcome_phone_number'));
$customRule['welcome_message'] = 'required';
$customRule['welcome_phone_number'] = 'required';
$messages = array('required' => 'Harap mengisi informasi :attribute.', 'image' => 'Tipe file gambar yang Anda berikan salah, mohon mencoba kembali.');
$validator = Validator::make($data, $customRule, $messages);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
if (Input::hasFile('welcome_photo')) {
// checking file is valid.
if (Input::file('welcome_photo')->isValid()) {
$destinationPath = '/uploads/anggota';
// upload path
$extension = Input::file('welcome_photo')->getClientOriginalExtension();
// getting image extension
$fileName = $user->id . '.' . $extension;
// rename image
Input::file('welcome_photo')->move(public_path() . $destinationPath, $fileName);
// uploading file to given path
$data['welcome_photo'] = $destinationPath . "/" . $fileName;
} else {
// sending back with error message.
return Redirect::back()->with('errors', 'Uploaded file is not valid')->withInput();
}
}
$user->update($data);
return Redirect::route('member.dashboard')->with("message", "Data berhasil disimpan");
}
开发者ID:arbuuuud,项目名称:gnt-aops,代码行数:31,代码来源:UsersController.php
示例8: store
public function store(PostRequest $request)
{
if (Input::has('link')) {
$input['link'] = Input::get('link');
$info = Embed::create($input['link']);
if ($info->image == null) {
$embed_data = ['text' => $info->description];
} else {
if ($info->description == null) {
$embed_data = ['text' => ''];
} else {
$orig = pathinfo($info->image, PATHINFO_EXTENSION);
$qmark = str_contains($orig, '?');
if ($qmark == false) {
$extension = $orig;
} else {
$extension = substr($orig, 0, strpos($orig, '?'));
}
$newName = public_path() . '/images/' . str_random(8) . ".{$extension}";
if (File::exists($newName)) {
$imageToken = substr(sha1(mt_rand()), 0, 5);
$newName = public_path() . '/images/' . str_random(8) . '-' . $imageToken . ".{$extension}";
}
$image = Image::make($info->image)->fit(70, 70)->save($newName);
$embed_data = ['text' => $info->description, 'image' => basename($newName)];
}
}
Auth::user()->posts()->create(array_merge($request->all(), $embed_data));
return redirect('/subreddit');
}
Auth::user()->posts()->create($request->all());
return redirect('/subreddit');
}
开发者ID:ReyRodriguez,项目名称:laravel-reddit,代码行数:33,代码来源:PostsController.php
示例9: __construct
public function __construct()
{
$this->script_url = URL('file/photos/delete_image');
$this->upload_dir = public_path() . '/uploads/images/';
$this->upload_url = URL('/') . '/uploads/images/';
$this->fileName = 'files';
}
开发者ID:Zachary-Leung,项目名称:wine_platform,代码行数:7,代码来源:PhotosController.php
示例10: procesarImagenModelo
protected function procesarImagenModelo($imagen)
{
$filename = date('Y-m-d-H:i:s') . "-" . $imagen->getClientOriginalName();
$pathCompleto = $this->imagePath . $filename;
Image::make($imagen->getRealPath())->resize($this->_imageSize['width'], $this->_imageSize['height'])->save(public_path($pathCompleto));
return $pathCompleto;
}
开发者ID:00dav00,项目名称:marcadores-minimal,代码行数:7,代码来源:ImageTrait.php
示例11: register
/**
* @inherit
*/
public function register()
{
// Enable "@include("sledgehammer:statusbar") in blade
$this->loadViewsFrom(dirname(__DIR__) . '/views', 'sledgehammer');
// Register the public assets for `php artisan vendor:publish`
$this->publishes([dirname(__DIR__) . '/public' => public_path('sledgehammer'), dirname(dirname(__DIR__)) . '/core/public' => public_path('sledgehammer/core')], 'public');
}
开发者ID:sledgehammer,项目名称:laravel,代码行数:10,代码来源:SledgehammerServiceProvider.php
示例12: generate
/**
* Return captcha image
* @param number $maxChar
*/
public function generate($maxChar = 4)
{
// $characters = '23456789abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ';
$characters = 'ABCDEFGHKMNPQRST';
$captchaText = '';
for ($i = 0; $i < $maxChar; $i++) {
$captchaText .= $characters[rand(0, strlen($characters) - 1)];
}
strtoupper(substr(md5(microtime()), 0, 7));
\Session::put('captchaHash', \Hash::make($captchaText));
$image = imagecreate(30 * $maxChar, 35);
$background = imagecolorallocatealpha($image, 255, 255, 255, 1);
$textColor = imagecolorallocatealpha($image, 206, 33, 39, 1);
$x = 5;
$y = 20;
$angle = 0;
for ($i = 0; $i < 7; $i++) {
$fontSize = 16;
$text = substr($captchaText, $i, 1);
imagettftext($image, $fontSize, $angle, $x, $y, $textColor, public_path('/fonts/LibreBaskerville/librebaskerville-regular.ttf'), $text);
$x = $x + 17 + mt_rand(1, 10);
$y = mt_rand(18, 25);
$angle = mt_rand(0, 20);
}
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Pragma: no-cache');
header('Content-type: image/jpeg');
imagejpeg($image, null, 100);
imagedestroy($image);
}
开发者ID:atudz,项目名称:gorabelframework,代码行数:34,代码来源:CaptchaLibrary.php
示例13: deleteManifest
/**
* Delete Manifest file(s) in the application's assets path
*
* @return void
*/
protected function deleteManifest()
{
$manifests = find_paths(public_path('assets/') . 'manifest-*.json');
foreach ($manifests as $manifest) {
File::delete($manifest);
}
}
开发者ID:efficiently,项目名称:larasset,代码行数:12,代码来源:AssetsCommand.php
示例14: boot
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot()
{
$this->publishes([__DIR__ . '/../../resources/assets' => public_path('vendor/jplatform')], 'public');
app('Dingo\\Api\\Auth\\Auth')->extend('inSession', function ($app) {
return app('jarvis.auth.provider');
});
}
开发者ID:hechoenlaravel,项目名称:jarvis-foundation,代码行数:12,代码来源:JarvisFoundationServiceProvider.php
示例15: postIndex
/**
* Validates and stores the user's update data.
*
* @author [A. Gianotto] [<[email protected]>]
* @since [v1.0]
* @return Redirect
*/
public function postIndex()
{
// Grab the user
$user = Auth::user();
// Update the user information
$user->first_name = e(Input::get('first_name'));
$user->last_name = e(Input::get('last_name'));
$user->website = e(Input::get('website'));
$user->location_id = e(Input::get('location_id'));
$user->gravatar = e(Input::get('gravatar'));
$user->locale = e(Input::get('locale'));
if (Input::file('avatar')) {
$image = Input::file('avatar');
$file_name = $user->first_name . "-" . $user->last_name . "." . $image->getClientOriginalExtension();
$path = public_path('uploads/avatars/' . $file_name);
Image::make($image->getRealPath())->resize(84, 84)->save($path);
$user->avatar = $file_name;
}
if (Input::get('avatar_delete') == 1 && Input::file('avatar') == "") {
$user->avatar = null;
}
if ($user->save()) {
return redirect()->route('profile')->with('success', 'Account successfully updated');
}
return redirect()->back()->withInput()->withErrors($user->getErrors());
}
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:33,代码来源:ProfileController.php
示例16: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$productAttributeGroup = ProductAttributeGroup::create(['title' => 'Basic']);
$seoGroup = ProductAttributeGroup::create(['title' => 'SEO']);
$inventoryGroup = ProductAttributeGroup::create(['title' => 'Inventory']);
ProductAttribute::insert([['title' => 'Title', 'product_attribute_group_id' => $productAttributeGroup->id, 'identifier' => 'title', 'type' => 'VARCHAR', 'field_type' => 'TEXT', 'validation' => 'required|max:255'], ['title' => 'Price', 'product_attribute_group_id' => $productAttributeGroup->id, 'identifier' => 'price', 'type' => 'FLOAT', 'field_type' => 'TEXT', 'validation' => 'required|max:8|regex:/^-?\\d*(\\.\\d+)?$/'], ['title' => 'Image', 'product_attribute_group_id' => 0, 'identifier' => 'image', 'type' => 'FILE', 'field_type' => 'FILE', 'validation' => ''], ['title' => 'SKU', 'product_attribute_group_id' => $productAttributeGroup->id, 'identifier' => 'sku', 'type' => 'VARCHAR', 'field_type' => 'TEXT', 'validation' => 'required|max:255'], ['title' => 'Slug', 'product_attribute_group_id' => $productAttributeGroup->id, 'identifier' => 'slug', 'type' => 'VARCHAR', 'field_type' => 'TEXT', 'validation' => 'required|max:255|alpha_dash'], ['title' => 'Page Title', 'product_attribute_group_id' => $seoGroup->id, 'identifier' => 'page_title', 'type' => 'VARCHAR', 'field_type' => 'TEXT', 'validation' => 'max:255'], ['title' => 'Page Description', 'product_attribute_group_id' => $seoGroup->id, 'identifier' => 'page_description', 'type' => 'VARCHAR', 'field_type' => 'TEXTAREA', 'validation' => 'max:255'], ['title' => 'Qty', 'product_attribute_group_id' => $inventoryGroup->id, 'identifier' => 'qty', 'type' => 'VARCHAR', 'field_type' => 'TEXT', 'validation' => ''], ['title' => 'Description', 'product_attribute_group_id' => $productAttributeGroup->id, 'identifier' => 'description', 'type' => 'TEXT', 'field_type' => 'TEXTAREA', 'validation' => 'required']]);
$statusAttribute = ProductAttribute::create(['title' => 'Status', 'product_attribute_group_id' => $productAttributeGroup->id, 'identifier' => 'status', 'type' => 'VARCHAR', 'field_type' => 'SELECT', 'validation' => 'required']);
AttributeDropdownOption::create(['product_attribute_id' => $statusAttribute->id, 'value' => '1', 'label' => 'Enabled']);
AttributeDropdownOption::create(['product_attribute_id' => $statusAttribute->id, 'value' => '0', 'label' => 'Disabled']);
$isTaxableAttribute = ProductAttribute::create(['title' => 'Is Taxable', 'product_attribute_group_id' => $inventoryGroup->id, 'identifier' => 'is_taxable', 'type' => 'VARCHAR', 'field_type' => 'SELECT', 'validation' => 'required']);
AttributeDropdownOption::create(['product_attribute_id' => $isTaxableAttribute->id, 'value' => '1', 'label' => 'Yes']);
AttributeDropdownOption::create(['product_attribute_id' => $isTaxableAttribute->id, 'value' => '0', 'label' => 'No']);
$featureAttribute = ProductAttribute::create(['title' => 'Is Featured', 'product_attribute_group_id' => $productAttributeGroup->id, 'identifier' => 'is_featured', 'type' => 'VARCHAR', 'field_type' => 'SELECT', 'validation' => 'required']);
AttributeDropdownOption::create(['product_attribute_id' => $featureAttribute->id, 'value' => '0', 'label' => 'No']);
AttributeDropdownOption::create(['product_attribute_id' => $featureAttribute->id, 'value' => '1', 'label' => 'Yes']);
$inStockAttribute = ProductAttribute::create(['title' => 'In Stock', 'product_attribute_group_id' => $inventoryGroup->id, 'identifier' => 'in_stock', 'type' => 'VARCHAR', 'field_type' => 'SELECT', 'validation' => 'required']);
AttributeDropdownOption::create(['product_attribute_id' => $inStockAttribute->id, 'value' => '1', 'label' => 'Yes']);
AttributeDropdownOption::create(['product_attribute_id' => $inStockAttribute->id, 'value' => '0', 'label' => 'No']);
$trackStockAttribute = ProductAttribute::create(['title' => 'Track Stock', 'product_attribute_group_id' => $inventoryGroup->id, 'identifier' => 'track_stock', 'type' => 'VARCHAR', 'field_type' => 'SELECT', 'validation' => '']);
AttributeDropdownOption::create(['product_attribute_id' => $trackStockAttribute->id, 'value' => '1', 'label' => 'Yes']);
AttributeDropdownOption::create(['product_attribute_id' => $trackStockAttribute->id, 'value' => '0', 'label' => 'No']);
OrderStatus::insert(['title' => 'pending', 'is_default' => 1, 'is_last_stage' => 0], ['title' => 'processing', 'is_default' => 0, 'is_last_stage' => 0], ['title' => 'complete', 'is_default' => 0, 'is_last_stage' => 1]);
$path = public_path() . '/countries.json';
$json = json_decode(file_get_contents($path), true);
foreach ($json as $code => $name) {
$countires[] = ['code' => $code, 'name' => $name];
}
Country::insert($countires);
}
开发者ID:mage2,项目名称:laravel-ecommerce,代码行数:34,代码来源:Mage2CatalogSeeder.php
示例17: run
public function run()
{
DB::table('mst_countries')->truncate();
$country_name_full = array();
$country_name_file = app_path() . "/country_name_new.txt";
$myfile_country_name = fopen($country_name_file, "r") or die("Unable to open file!");
$read_country_name_file = fread($myfile_country_name, filesize($country_name_file));
$array_country_names = explode("\n", $read_country_name_file);
foreach ($array_country_names as $key_country_names) {
if ($key_country_names != null) {
$country_name_list = explode(" ", $key_country_names);
$country_name_full[$country_name_list[0]] = $country_name_list[1];
}
}
$country_name_ja = "";
$file_folder = public_path() . "/flags/";
//use the directory class
$files = dir($file_folder);
//read all files ;from the directory
chdir($file_folder);
$file_names = glob('*.png');
$i = 1;
//$c = 1;
foreach ($file_names as $file_name) {
$country_name_en = explode('.', $file_name, -1);
if (!empty($country_name_full[$country_name_en[0]])) {
$country_name_ja = $country_name_full[$country_name_en[0]];
}
$country = array("country_name" => $country_name_en[0], "flag_url" => "flags/" . $file_name, "country_name_ja" => $country_name_ja);
Country::create($country);
$i++;
echo $i . "\n";
}
closedir($files->handle);
}
开发者ID:anht37,项目名称:winelover_server,代码行数:35,代码来源:CountryTableSeeder.php
示例18: setAvatarAttribute
public function setAvatarAttribute($avatar)
{
if (is_object($avatar) && $avatar->isValid()) {
ImageManagerStatic::make($avatar)->fit(150, 150)->save(public_path() . "/img/avatars/{$this->id}.jpg");
$this->attributes['avatar'] = true;
}
}
开发者ID:emile442,项目名称:altis-pan,代码行数:7,代码来源:User.php
示例19: url
/**
* Attach theme paths to a local Url. The Url must be a resource located on the asset path
* of the current theme or it's parents.
*
* @param string $url
* @return string
*/
public function url($url)
{
// return external URLs unmodified
if (preg_match('/^((http(s?):)?\\/\\/)/i', $url)) {
return $url;
}
// Is it on AWS? Dont lookup parent themes...
if (preg_match('/^((http(s?):)?\\/\\/)/i', $this->assetPath)) {
return $this->assetPath . '/' . ltrim($url, '/');
}
// Lookup asset in current's theme asset path
$fullUrl = (empty($this->assetPath) ? '' : '/') . $this->assetPath . '/' . ltrim($url, '/');
if (file_exists($fullPath = public_path($fullUrl))) {
return $fullUrl;
}
// If not found then lookup in parent's theme asset path
if ($this->getParent()) {
return $this->getParent()->url($url);
}
// Asset not found at all. Error handling
$action = \Config::get('themes.asset_not_found', 'LOG_ERROR');
if ($action == 'THROW_EXCEPTION') {
throw new themeException("Asset not found [{$url}]");
} elseif ($action == 'LOG_ERROR') {
\Log::warning("Asset not found [{$url}] in Theme [" . \Theme::get() . "]");
} elseif ($action === 'ASSUME_EXISTS') {
$assetPath = \Theme::find(\Theme::get())->assetPath;
return (empty($assetPath) ? '' : '/') . $assetPath . '/' . ltrim($url, '/');
}
}
开发者ID:mauro-moreno,项目名称:laravel-theme,代码行数:37,代码来源:Theme.php
示例20: boot
public function boot()
{
/*Assets , CKEDITOR*/
$this->publishes([__DIR__ . '/../assets/' => public_path('drauta/bloglaravel')], 'public');
/*Migrations*/
$this->publishes([__DIR__ . '/../database/migrations/' => database_path('migrations')], 'migrations');
}
开发者ID:drauta,项目名称:blog-laravel,代码行数:7,代码来源:BlogLaravelServiceProvider.php
注:本文中的public_path函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论