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


PHP Sanitize::string方法代码示例

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


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

示例1: postAddBoard

 public function postAddBoard()
 {
     if (Auth::check()) {
         $rules = array('hashtag' => 'required|min:3', 'avatar' => 'mimes:jpg,jpeg,png|image|max:1024|image_size:>=300', 'cover' => 'mimes:jpg,jpeg,png|image|max:3072|image_size:>=1200,>=150', 'presentation_cover' => 'mimes:jpg,jpeg,png|image|max:4096|image_size:>=1200,*', 'website_url' => 'url', 'refresh_interval' => 'integer|min:10|max:120', 'refresh_count' => 'integer|min:1|max:100');
         $user = Auth::user();
         $validator = Validator::make(Input::all(), $rules);
         if ($validator->fails()) {
             $messages = $validator->messages();
             return Redirect::to('/konto/tablica/dodaj')->withInput(Input::flash())->withErrors($validator)->with('alert', array('type' => 'error', 'content' => 'Błąd! Sprawdź wszystkie pola.'));
         } else {
             $data = Input::get('hashtag');
             $data = explode(' ', trim($data));
             $result = preg_replace('/#([\\w-]+)/i', '$1', $data[0]);
             $hashtag = Sanitize::string($result);
             $board = Board::create(array('hashtag' => $hashtag, 'description' => Input::get('description'), 'avatar' => Input::file('avatar'), 'cover' => Input::file('cover'), 'presentation_cover' => Input::file('presentation_cover'), 'fb_user' => Input::get('fb_user'), 'tw_user' => Input::get('tw_user'), 'insta_user' => Input::get('insta_user'), 'google_user' => Input::get('google_user'), 'website_url' => Input::get('website_url')));
             $fb = Input::has('has_fb') ? 0 : -1;
             $insta = Input::has('has_insta') ? 0 : -1;
             $tw = Input::has('has_tw') ? 0 : -1;
             $google = Input::has('has_google') ? 0 : -1;
             $vine = Input::has('has_vine') ? 0 : -1;
             $refreshInterval = Input::has('refresh_interval') ? Input::get('refresh_interval') : 30;
             $refreshCount = Input::has('refresh_count') ? Input::get('refresh_count') : 2;
             $bannedUsers = Input::has('banned_users') ? Input::get('banned_users') : '';
             $filter = Input::has('filters') ? Input::get('filters') : '';
             $live = Input::has('live') ? 1 : 0;
             $presentation = Input::has('presentation') ? 1 : 0;
             $color = Input::has('color') ? Input::get('color') : '';
             $config = BoardConfig::create(array('board_id' => $board->id, 'user_id' => $user->id, 'has_fb' => $fb, 'has_insta' => $insta, 'has_tw' => $tw, 'has_google' => $google, 'has_vine' => $vine, 'refresh_interval' => $refreshInterval, 'refresh_count' => $refreshCount, 'presentation' => $presentation, 'color' => $color, 'live' => $live, 'banned_users' => $bannedUsers, 'filter' => $filter));
             Stat::create(array('board_id' => $board->id));
             return Redirect::to('/konto/tablice')->with('alert', array('type' => 'success', 'content' => 'Tablica utworzona!'));
         }
     }
 }
开发者ID:itsfamestudio,项目名称:hashtag,代码行数:33,代码来源:UserController.php

示例2: function

    Auth::logout();
    return Redirect::to('/');
});
Route::get('/ajax/cookies', function () {
    Cookie::queue('cookie_accept', 'yes', 2628000);
});
// boards
Route::post('/board/post/featured/remove', array('before' => 'auth', 'uses' => 'AjaxController@removeFeatured'));
Route::post('/board/post/featured', array('before' => 'auth', 'uses' => 'AjaxController@postFeatured'));
Route::post('/popup/share', array('uses' => 'AjaxController@showPopupShare'));
Route::post('/board/update/description', array('uses' => 'AjaxController@postUpdateBoardDescription'));
Route::get('/show/board/{id}', array('uses' => 'AjaxController@showBoard'));
Route::post('/show/board/more/{id}', array('uses' => 'AjaxController@showBoardMore'));
Route::post('/show/board/new/{id}', array('uses' => 'AjaxController@showBoardNew'));
Route::get('{hashtag}/{id}/{presentation}', array('uses' => 'BoardsController@showBoard'));
Route::get('{query}/szukaj', array('uses' => 'BoardsController@showBoard'));
Route::get('{hashtag}/{id}', array('uses' => 'BoardsController@showBoard'));
Route::post('/szukaj', function () {
    $data = Input::get('query');
    if (strlen($data) > 2) {
        if (Input::has('fill')) {
            App::abort(404);
        }
        $data = explode(' ', trim($data));
        $result = preg_replace('/#([\\w-]+)/i', '$1', $data[0]);
        $query = Sanitize::string($result);
        return Redirect::to($query . '/szukaj');
    } else {
        return Redirect::back()->with('alert', array('type' => 'error', 'content' => 'Ten hasztag jest za krótki.'));
    }
});
开发者ID:itsfamestudio,项目名称:hashtag,代码行数:31,代码来源:routes.php

示例3: showBoard

 public function showBoard($query, $id = NULL, $presentation = NULL)
 {
     Asset::add('//cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.0.0/isotope.pkgd.min.js', 'footer');
     Asset::add('//cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.0.4/jquery.imagesloaded.min.js', 'footer');
     Asset::add('/js/libs/jquery.dropdown.js', 'footer');
     //Asset::add('/js/posts.js', 'footer');
     Asset::add('/js/posts-new.js', 'footer');
     //check if board exists
     if (strlen($query) > 2) {
         $query = explode(' ', trim($query));
         $result = preg_replace('/#([\\w-]+)/i', '$1', $query[0]);
         $query = Sanitize::string($result);
     } else {
         App::abort(404);
     }
     if (isset($id)) {
         $board = Board::find($id);
         if (!is_null($board)) {
             if ($board->hashtag != $query || $board->config()->first()->user_id == 0) {
                 App::abort(404);
             }
         } else {
             App::abort(404);
         }
     } else {
         $board = Board::where('hashtag', '=', $query)->whereHas('config', function ($q) {
             $q->where('user_id', '=', 0);
         })->first();
         if (is_null($board)) {
             $board = Board::create(array('hashtag' => $query));
             $visit = Visit::create(array('ip' => Request::ip()));
             $config = BoardConfig::create(array('board_id' => $board->id));
         }
     }
     if ($board->config()->first()->is_active == 1) {
         if (!is_null($board->cover_file_name)) {
             $data['layout'] = $this->layout->cover = 'with-cover';
         } else {
             $data['layout'] = $this->layout->cover = 'no-cover';
         }
         if (Auth::check()) {
             $user = Auth::user();
             $data['username'] = preg_replace('/@.*?$/', '', $user->email);
             $data['userBoards'] = Board::byUserId($user)->orderBy('created_at', 'asc')->get();
             $data['user'] = $user;
             if ($user->id == $board->config()->first()->user_id) {
                 $userOwned = true;
             }
             if (!is_null($user->provider()->first()) && $user->provider()->first()->provider == 'facebook') {
                 $data['avatar'] = '<img src="http://graph.facebook.com/' . $user->provider()->first()->provider_id . '/picture?type=small" alt="avatar" />';
             }
         }
         if (Session::get('session-stat') != $board->id) {
             $stats = Stat::firstOrCreate(array('board_id' => $board->id))->increment('hits');
             Session::put('session-stat', $board->id);
         }
         $data['board'] = $board;
         $data['boardData'] = $this->layout->boardData = $board;
         $data['title'] = $this->layout->title = $board->hashtag;
         $data['bodyClass'] = $this->layout->bodyClass = $board->hashtag . (isset($userOwned) ? ' user-owned' : '');
         if (isset($presentation) && $presentation != 'live') {
             App::abort(404);
         }
         if (isset($id) && $presentation == 'live' && $board->config()->first()->presentation == 1) {
             $data['bodyClass'] = $this->layout->bodyClass = $board->hashtag . (isset($userOwned) ? ' user-owned' : '') . ' board-presentation';
             $this->layout->content = View::make('boards.board-presentation', $data);
         } else {
             $this->layout->content = View::make('boards.index', $data);
         }
     } else {
         App::abort(404);
     }
 }
开发者ID:itsfamestudio,项目名称:hashtag,代码行数:73,代码来源:BoardsController.php


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