当前位置: 首页>>代码示例>>PHP>>正文


PHP Setting::fetch方法代码示例

本文整理汇总了PHP中Setting::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::fetch方法的具体用法?PHP Setting::fetch怎么用?PHP Setting::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Setting的用法示例。


在下文中一共展示了Setting::fetch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getBannerURL

 public static function getBannerURL($cid, $banner_directory = "")
 {
     $user = User::findOrFail($cid);
     //Remove trailing slash, if present, and readd.
     if (empty($banner_directory)) {
         $banner_directory = rtrim(Setting::fetch('banner_directory'), '/') . '/';
     }
     //Add the current file update time to the end of the image link so that the browser will not cache the image if it is newer then what is previously loaded.
     $bannerurl = URL::to('/') . $banner_directory . $user->banner . '?last_picture_update=' . filemtime(public_path() . $banner_directory . $user->banner);
     return $bannerurl;
 }
开发者ID:A-Lawrence,项目名称:VASOPS,代码行数:11,代码来源:User.php

示例2: post_uploadbanner

 public function post_uploadbanner()
 {
     //Verify we have a file
     if (Input::hasFile('inputBanner')) {
         //Get our file
         $banner = Input::file('inputBanner');
         //Create an array of acceptable mimetypes
         $mimetypes = array('image/jpeg', 'image/png');
         if (in_array($banner->getMimeType(), $mimetypes)) {
             switch ($banner->getMimeType()) {
                 case 'image/jpeg':
                     $extension = ".jpg";
                     break;
                 case 'image/png':
                     $extension = ".png";
                     break;
             }
             //Get our image height min and max
             $maxheight = Setting::fetch('banner_maxheight');
             $maxwidth = Setting::fetch('banner_maxwidth');
             list($width, $height) = getimagesize($banner);
             //Is the width or height larger than the max?
             if ($width > $maxwidth || $height > $maxheight) {
                 App::abort(400, 'Image is larger than the max width: ' . $maxwidth . 'px or max height: ' . $maxheight . 'px');
             }
             //Mime check passed continue to move the image from tmp directory to /banners
             $destinationPath = public_path() . Setting::fetch('banner_directory');
             $fileName = Auth::user()->get()->cid . $extension;
             $banner->move($destinationPath, $fileName);
             //Finally update the db with the new banner name.
             $va = User::where('cid', '=', Auth::user()->get()->cid)->first();
             $va->banner = $fileName;
             $va->save();
             //Redirect the user back to the banner page
             return Redirect::to(route('va') . '#banner');
         } else {
             //Time to abort.
             App::abort(400, 'Invalid file type.');
         }
     }
 }
开发者ID:A-Lawrence,项目名称:VASOPS,代码行数:41,代码来源:VaController.php

示例3: post_searchvas

 public function post_searchvas()
 {
     $query = Input::get('query');
     $vas = User::where('status', '=', 1)->where(function ($q) use($query) {
         $q->where('vaname', 'like', '%' . $query . '%')->orWhere('description', 'like', '%' . $query . '%')->orWhere('url', 'like', '%' . $query . '%')->orWhere('url', 'like', '%' . $query . '%');
     })->orderBy('vaname', 'ASC')->get();
     if (count($vas) == 0 || empty($query) || $query == " ") {
         echo '<h4>No Virtual Airlines Found.</h4>';
     } else {
         $maxwidth = Setting::fetch('banner_maxwidth');
         $banner_directory = rtrim(Setting::fetch('banner_directory'), '/') . '/';
         $output = '';
         foreach ($vas as $va) {
             $va->description = html_entity_decode($va->description);
             $va->vaname = html_entity_decode($va->vaname);
             $va->url = html_entity_decode($va->url);
             $banner = '';
             if ($va->banner) {
                 $banner = User::getBannerUrl($va->cid, $banner_directory);
                 $output .= '<div class="bannerbg"><a target="_blank" href="' . URL::to('/click') . '/' . $va->cid . '"><img style="max-width:' . $maxwidth . ';" class="img-polaroid" src="' . $banner . '" alt="Banner" /></a></div><div class="well"><a target="_blank" href="' . URL::to('/click') . '/' . $va->cid . '"><h4>' . $va->vaname . '</h4></a><blockquote style="margin-top: 4px;">' . $va->description . '</blockquote></div>';
             } else {
                 $output .= '<div class="well"><a target="_blank" href="' . URL::to('/click') . '/' . $va->cid . '"><h4>' . $va->vaname . '</h4></a><blockquote style="margin-top: 4px;">' . $va->description . '</blockquote></div>';
             }
         }
         echo $output;
     }
 }
开发者ID:A-Lawrence,项目名称:VASOPS,代码行数:27,代码来源:AjaxController.php

示例4: post_vapubliccategoriessave

 public function post_vapubliccategoriessave()
 {
     $cid = Input::get('cid');
     $user = User::findOrFail($cid);
     $categories = Input::get('categories');
     if (empty($categories)) {
         $categories = '';
     }
     //Fuck it. Let's just start the validator
     $validator = Validator::make(array('categories' => $categories), array('categories' => 'max: ' . Setting::fetch('max_categories')), array('categories.max' => 'You have selected more than :max categories.'));
     if ($validator->fails()) {
         // The given data did not pass validation
         $messages = $validator->messages();
         $errorStr = '';
         foreach ($messages->all('<li>:message</li>') as $message) {
             $errorStr .= $message;
         }
         return Redirect::to('console/va/' . $cid . '#categories')->with('message', $errorStr);
     }
     //We need to check and see if any hidden categories are currently included in the categories string and add them to our new string if so
     $currentCategories = explode(',', $user->categories);
     array_pop($currentCategories);
     //Get a list of hidden categories
     $appendlist = '';
     foreach ($currentCategories as $currentCategory) {
         if (Category::isHiddenCategory($currentCategory)) {
             $appendlist .= $currentCategory . ',';
         }
     }
     $categories = implode(',', $categories);
     $categories .= ',' . $appendlist;
     $user->categories = $categories;
     $user->save();
     return Redirect::to('console/va/' . $cid . '#categories')->with('message', 'Public Categories Saved Successfully.');
 }
开发者ID:A-Lawrence,项目名称:VASOPS,代码行数:35,代码来源:ConsoleController.php


注:本文中的Setting::fetch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。