Beispiel #1
0
/**
 * 以递归的形式遍历一个数组,审查每一个对象
 * @param $array
 * @return array
 */
function array_strip_tags($array)
{
    $result = array();
    foreach ($array as $key => $value) {
        $key = strip_tags($key);
        if (is_array($value)) {
            $result[$key] = array_strip_tags($value);
        } else {
            $result[$key] = htmlspecialchars(trim(strip_tags($value, ENT_QUOTES | ENT_HTML5)));
        }
    }
    return $result;
}
Beispiel #2
0
function array_strip_tags($array)
{
    $result = array();
    foreach ($array as $key => $value) {
        $key = strip_tags($key);
        if (is_array($value)) {
            $result[$key] = array_strip_tags($value);
        } else {
            $result[$key] = strip_tags($value);
        }
    }
    return $result;
}
Beispiel #3
0
<?php

/*
|--------------------------------------------------------------------------
| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    Input::merge(array_strip_tags(Input::all()));
    /*
        Route::matched(function($route, $request) {
    
          if($route->getName() != 'route_not_translate') { // don't do it for exclusive area
    
            $language = 'en'; //english is fallback locale
            $lgs = ['ru','en'];
    
            // get the default browser language with the $request object
            $browserLg = substr($request->server->get('HTTP_ACCEPT_LANGUAGE'), 0, 2);
    
            //these to strings should be removed if you uncomment next block of parsing address
            if(in_array($browserLg, $lgs))
                $language = $browserLg;
    
            //block of parsing address is not needed as all pages have the same address for both languages