當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。