コード例 #1
0
 public static function var_dump_html($var, $return = false)
 {
     ob_start();
     var_dump($var);
     $contents = ob_get_clean();
     $contents = "<pre style='text-align:left; font-size: 9pt; background: #EFEFEF; padding: 10px; border: solid 1px #000; margin: 0px 0px 0px; font-family: monospace'>" . HTMLHelper::escape($contents) . "</pre>";
     if ($return) {
         return $contents;
     } else {
         echo $contents;
     }
 }
コード例 #2
0
ファイル: String.php プロジェクト: zentefi/zentefi-laravel
 public static function get_language_html($language, $text, $arg1 = null, $arg2 = null)
 {
     $args = func_get_args();
     $text = call_user_func_array(array('ZPHP\\String', 'get_language'), $args);
     return HTMLHelper::escape($text);
 }
コード例 #3
0
 public static function require_http_basic_auth_users(array $users, $text = 'Login')
 {
     header('WWW-Authenticate: Basic realm="' . HTMLHelper::escape($text) . '"');
     if (isset($_SERVER['PHP_AUTH_USER'])) {
         $user = $_SERVER['PHP_AUTH_USER'];
         if (isset($_SERVER['PHP_AUTH_PW'])) {
             $pass = $_SERVER['PHP_AUTH_PW'];
         } else {
             $pass = null;
         }
         foreach ((array) $users as $user_data) {
             if (is_array($user_data) && isset($user_data['user'])) {
                 if ($user_data['user'] == $user && $user_data['password'] == $pass) {
                     header('HTTP/1.0 200 OK');
                     return true;
                 }
             }
         }
     }
     if (!isset($_SERVER['PHP_AUTH_USER'])) {
         header('HTTP/1.0 401 Unauthorized');
         header('Status: 401 Unauthorized');
         die;
     }
 }