コード例 #1
0
ファイル: File.php プロジェクト: thezawad/vakuum
 private function writeFile($filename, $contents, $gzip = true)
 {
     if ($gzip && self::$enable_gzip) {
         $contents = gzdeflate($contents);
     }
     file_put_contents($filename, $contents);
 }
コード例 #2
0
/**
 * Generates an encoded and compressed string from the specified 
 * string. The string is encoded in the following order:
 *
 * 1. Deflate
 * 2. Base64 encode
 * 3. URL encode
 * @param string $msg
 * @return string
 */
function samlEncodeMessage($msg)
{
    $encmsg = gzdeflate($msg);
    $encmsg = base64_encode($encmsg);
    $encmsg = urlencode($encmsg);
    return $encmsg;
}
コード例 #3
0
function __out($data, $type = '', $callback = '')
{
    if (empty($type)) {
        if (isset($_REQUEST['gz'])) {
            $type = 'gz';
        } else {
            if (isset($_REQUEST['gz2'])) {
                $type = 'gz2';
            } elseif (isset($_REQUEST['json'])) {
                $type = 'json';
            } elseif (isset($_REQUEST['jsonp'])) {
                $type = 'jsonp';
            }
        }
    }
    if ($type === 'gz') {
        $s = serialize($data);
        print gzdeflate($s, 9);
    } elseif ($type === 'gz2') {
        $s = serialize($data);
        print gzencode($s, 9);
    } elseif ($type === 'json') {
        print json_encode($data);
    } elseif ($type === 'jsonp') {
        if (empty($callback) && isset($_GET['callback'])) {
            $callback = $_GET['callback'];
        }
        print $callback . '(' . json_encode($data) . ');';
    } else {
        $s = serialize($data);
        print $s;
    }
}
コード例 #4
0
 /**
  * 导出
  */
 public function siteExport($filename = '')
 {
     if (IS_POST) {
         $setting_db = M('setting');
         $data = array('type' => 'setting');
         $data['data'] = $setting_db->select();
         $data['verify'] = md5(var_export($data['data'], true) . $data['type']);
         //数据进行多次加密,防止数据泄露
         $data = base64_encode(gzdeflate(json_encode($data)));
         $uniqid = uniqid();
         $filename = UPLOAD_PATH . 'export/' . $uniqid . '.data';
         if (file_write($filename, $data)) {
             $this->success('导出成功', U('Setting/siteExport', array('filename' => $uniqid)));
         }
         $this->error('导出失败,请重试!');
     } else {
         //过滤特殊字符,防止非法下载文件
         $filename = str_replace(array('.', '/', '\\'), '', $filename);
         $filename = UPLOAD_PATH . 'export/' . $filename . '.data';
         if (!file_exist($filename)) {
             $this->error('非法访问');
         }
         header('Content-type: application/octet-stream');
         header('Content-Disposition: attachment; filename="站点设置.data"');
         echo file_read($filename);
         file_delete($filename);
     }
 }
コード例 #5
0
ファイル: CompressPlugin.php プロジェクト: puwenhan/TCrypto
 public function saveAction($data)
 {
     if ($data === false) {
         return false;
     }
     return gzdeflate($data);
 }
コード例 #6
0
ファイル: Spock.php プロジェクト: calebeoliveira/Spock
 /**
  * Saves a cached object in the file system.
  *
  * @param mixed  $content The object to be stored. Stores all types, except the resource-type.
  */
 public function push($content)
 {
     if (!file_exists($this->path)) {
         mkdir($this->path, 0755);
     }
     file_put_contents($this->cacheFile, gzdeflate(serialize($content)));
 }
コード例 #7
0
 public function demoapp()
 {
     $sharedKey = 'abracadabra';
     $self = 'http' . ($_SERVER['HTTPS'] ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
     if ($_POST['doit']) {
         $idp = $_POST['idp'];
         if (!$idp) {
             $idp = "sp";
         }
         $request = array('_ID' => sha1(uniqid(mt_rand(), true)), '_Version' => '2.0', '_IssueInstant' => gmdate('Y-m-d\\TH:i:s\\Z', time()), '_Destination' => $self . "/{$idp}/singleSignOnService", '_ForceAuthn' => $_REQUEST['ForceAuthn'] ? 'true' : 'false', '_IsPassive' => $_REQUEST['IsPassive'] ? 'true' : 'false', '_AssertionConsumerServiceURL' => $self . "/main/" . __FUNCTION__, '_AttributeConsumingServiceIndex' => 5, '_ProtocolBinding' => 'JSON-Redirect', 'saml:Issuer' => array('__v' => $self . "/main"));
         foreach ((array) $_REQUEST['IDPList'] as $idp) {
             $idpList[] = array('_ProviderID' => $idp);
         }
         $relayState = 'Dummy RelayState ...';
         if ($idpList) {
             $request['samlp:Scoping']['samlp:IDPList']['samlp:IDPEntry'] = $idpList;
         }
         #$request['samlp:Scoping']['_ProxyCount'] = 2;
         $location = $request['_Destination'];
         $request = "SAMLRequest=" . urlencode(base64_encode(gzdeflate(json_encode($request)))) . ($relayState ? '&RelayState=' . urlencode($relayState) : '');
         $signature = urlencode(base64_encode(sha1($sharedKey . sha1($request))));
         header('Location: ' . $location . "?" . $request . "&Signature=" . $signature);
         print "<a href=\"{$location}?{$request}&Signature={$signature}\">{$location}</a>";
         exit;
     }
     $response = base64_decode($_REQUEST['SAMLResponse']);
     $hSAMLResponse = json_decode(gzinflate($response), 1);
     if ($rs = $_POST['RelayState']) {
         $rs = '&RelayState=' . $rs;
     }
     if ($response && base64_encode(sha1($sharedKey . sha1("jSAMLResponse={$response}{$rs}"))) != $_POST['Signature']) {
         $message = 'Integrity check failed (Sharedkey) ' . $_POST['Signature'] . ' != ' . base64_encode(sha1($sharedKey . sha1("jSAMLResponse={$response}{$rs}")));
     }
     print $this->_server->renderTemplate('demo', array('action' => $self . "/main/demoapp", 'hSAMLResponse' => $hSAMLResponse, 'message' => $message . " RelayState: " . $_GET['RelayState'], 'self' => $self));
 }
コード例 #8
0
ファイル: Deflate.php プロジェクト: buse974/dms
 /**
  * (non-PHPdoc).
  *
  * @param string $data
  *
  * @see \Dms\Coding\CodingInterface::encode()
  */
 public function encode($data = null)
 {
     if ($data != null) {
         $this->setData($data);
     }
     return gzdeflate($this->data);
 }
コード例 #9
0
 /**
  * @expectedException \Brainbits\Transcoder\Exception\DecodeFailedException
  */
 public function testDecodeThrowsErrorOnEmptyResult()
 {
     $testString = '';
     $encodedString = gzdeflate($testString);
     $result = $this->decoder->decode($encodedString);
     $this->assertSame($testString, $result);
 }
コード例 #10
0
 function streamData($data, $name, $time = 0, $level = -1)
 {
     $time = $this->dosTime($time);
     $crc = crc32($data);
     $dlen = strlen($data);
     $level < 0 && ($level = (int) $this->level);
     $level < 0 && ($level = self::LEVEL);
     $data = gzdeflate($data, $level);
     $zlen = strlen($data);
     $name = strtr($name, '\\', '/');
     $n = @iconv('UTF-8', 'CP850', $name);
     // If CP850 can not represent the filename, use unicode
     if ($name !== @iconv('CP850', 'UTF-8', $n)) {
         $n = $name;
         $h = "";
     } else {
         $h = "";
     }
     $nlen = strlen($n);
     $h = "" . $h . "" . pack('V', $time) . pack('V', $crc) . pack('V', $zlen) . pack('V', $dlen) . pack('v', $nlen) . pack('v', 0);
     // extra field length
     echo "PK", $h, $n, $data;
     $dlen = $this->dataLen;
     $this->dataLen += 4 + strlen($h) + $nlen + $zlen;
     $this->cdr[] = "PK" . "" . $h . pack('v', 0) . pack('v', 0) . pack('v', 0) . pack('V', 32) . pack('V', $dlen) . $n;
 }
コード例 #11
0
ファイル: ProjectResource.php プロジェクト: sing-group/Markyt
 public function beforeSave($options = array())
 {
     if (isset($this->data[$this->name]['file'])) {
         $this->data[$this->name]['file'] = gzdeflate($this->data[$this->name]['file'], 9);
     }
     return true;
 }
コード例 #12
0
 /**
  * Performs text encryption with openssl_encrypt and returns it as a string.<br />
  * If openssl_encrypt is not available encrypts with mcrypt, if mcrypt is not available encrypts with xor
  * 
  * @param string $text      The text to encode
  * @param string $key       [optionnal] The key to use. Default is the application key
  * @return string           The encrypted string
  */
 public static function encrypt($text, $key = null)
 {
     // Get the application key if no key is given
     if ($key === null) {
         $key = self::_getKey();
     }
     // To avoid same encoded string for the same string
     $text = self::hash($text) . '~~~' . $text;
     // If zlib is active we compress the value to crypt
     if (function_exists('gzdeflate')) {
         $text = gzdeflate($text, 9);
     }
     // Use openssl_encrypt with PHP >= 5.3.0
     if (Config::get('general.crypt_method', 'openssl') === 'openssl' && function_exists('openssl_encrypt') && in_array('BF-ECB', openssl_get_cipher_methods())) {
         $method = 'BF-ECB';
         $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($method));
         return strtr(openssl_encrypt($text, $method, $key), '+/', '-_');
     } else {
         if (function_exists('mcrypt_encrypt')) {
             $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
             $iv = mcrypt_create_iv($size, MCRYPT_RAND);
             $crypt = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, $iv);
             return rtrim(strtr(base64_encode($crypt), '+/', '-_'), '=');
         }
     }
     // ... else encrypt with xor technique
     $n = mb_strlen($text, '8bit');
     $m = mb_strlen($key, '8bit');
     if ($n !== $m) {
         $key = mb_substr(str_repeat($key, ceil($n / $m)), 0, $n, '8bit');
     }
     return base64_encode($text ^ $key);
 }
コード例 #13
0
ファイル: Compress.php プロジェクト: thekabal/tki
 public static function compress(string $output)
 {
     $request = Request::createFromGlobals();
     // Check to see if we have data, if not, then return empty string
     if ($output === null) {
         return (string) '';
     }
     // Handle the supported compressions.
     $supported_enc = array();
     if ($request->headers->get('HTTP_ACCEPT_ENCODING')) {
         $supported_enc = explode(',', $request->headers->get('HTTP_ACCEPT_ENCODING'));
     }
     if (in_array('gzip', $supported_enc) === true) {
         header('Vary: Accept-Encoding');
         header('Content-Encoding: gzip');
         $encoded_output = gzencode($output, 9);
         return (string) $encoded_output;
     } elseif (in_array('deflate', $supported_enc) === true) {
         header('Vary: Accept-Encoding');
         header('Content-Encoding: deflate');
         $deflated_output = gzdeflate($output, 9);
         return (string) $deflated_output;
     } else {
         return (string) $output;
     }
 }
コード例 #14
0
 /**
  * Serialize and add data to cache
  *
  * @param  array   $data  Data to be cached
  * @param  string  $filename  Name of cache file
  * @return bool    Status
  */
 public function save($data, $filename)
 {
     clearstatcache();
     $path = $this->_gen_path($filename);
     $file = $this->_full_file_path($filename);
     if ($this->_options['num_directory_levels'] > 0) {
         if (!is_writable($path)) {
             // Cache directory structure may need to be created
             $this->_create_sub_dir_structure($filename);
         }
         if (!is_writable($path)) {
             // A second check to make sure dir was created successfully
             return false;
         }
     }
     if ($this->_options['gzip_level'] > 0) {
         $res = @file_put_contents($file, gzdeflate($this->_serialize($data), $this->_options['gzip_level']));
     } else {
         $res = @file_put_contents($file, $this->_serialize($data));
     }
     // Serialize Only
     if ($res) {
         @chmod($file, $this->_options['umask_file']);
     }
     return $res;
 }
コード例 #15
0
 public function save($data, $id, $tags = array(), $specificLifetime = false)
 {
     if ($this->_options['compression']) {
         $data = gzdeflate($data);
     }
     return parent::save($data, $id, $tags, $specificLifetime);
 }
コード例 #16
0
function xthreads_attach_hash(&$odd = false)
{
    static $secret = null;
    if (!isset($secret)) {
        if (isset($GLOBALS['mybb']->config['database']['password'])) {
            $config =& $GLOBALS['mybb']->config;
        } else {
            @(include MYBB_ROOT . 'inc/config.php');
        }
        $secret = md5(substr(md5($config['database']['database'] . ',' . $config['database']['password']), 0, 12) . __FILE__);
        unset($config);
    }
    $key = $secret;
    if (defined('XTHREADS_EXPIRE_ATTACH_LINK') && XTHREADS_EXPIRE_ATTACH_LINK) {
        $time = floor(time() / XTHREADS_EXPIRE_ATTACH_LINK);
        if ($odd !== false) {
            if ($time % 2 != $odd) {
                --$time;
            }
        } else {
            $odd = $time % 2;
        }
        $key .= '|' . $time;
    }
    if (defined('XTHREADS_ATTACH_LINK_IPMASK') && XTHREADS_ATTACH_LINK_IPMASK) {
        $key .= '|' . (xthreads_get_ip() & 0xffffffff << 32 - XTHREADS_ATTACH_LINK_IPMASK);
    }
    // because PHP doesn't like ~(0xffffffff >> x)
    return crc32(md5(gzdeflate($key)));
}
コード例 #17
0
    /**
     * Generate the request.
     *
     * @return string A fully qualified URL that can be redirected to in order to process the authorization request.
     */
    public function getRedirectUrl()
    {
        $id = $this->_generateUniqueID();
        $issueInstant = $this->_getTimestamp();
        $request = <<<AUTHNREQUEST
<samlp:AuthnRequest
    xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
    xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
    ID="{$id}"
    Version="2.0"
    IssueInstant="{$issueInstant}"
    ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
    AssertionConsumerServiceURL="{$this->_settings->spReturnUrl}">
    <saml:Issuer>{$this->_settings->spIssuer}</saml:Issuer>
    <samlp:NameIDPolicy
        Format="{$this->_settings->requestedNameIdFormat}"
        AllowCreate="true"></samlp:NameIDPolicy>
    <samlp:RequestedAuthnContext Comparison="exact">
        <saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
    </samlp:RequestedAuthnContext>
</samlp:AuthnRequest>
AUTHNREQUEST;
        $deflatedRequest = gzdeflate($request);
        $base64Request = base64_encode($deflatedRequest);
        $encodedRequest = urlencode($base64Request);
        if (strpos($this->_settings->idpSingleSignOnUrl, '?') === FALSE) {
            return $this->_settings->idpSingleSignOnUrl . "?SAMLRequest=" . $encodedRequest;
        }
        return $this->_settings->idpSingleSignOnUrl . "&SAMLRequest=" . $encodedRequest;
    }
コード例 #18
0
ファイル: Request.php プロジェクト: BrunoChauvet/Filemanager
    /**
     * Generate the request.
     *
     * @return string A fully qualified URL that can be redirected to in order to process the authorization request.
     */
    public function getRedirectUrl()
    {
        // Build the request
        $id = $this->_generateUniqueID();
        $issueInstant = $this->_getTimestamp();
        $request = <<<AUTHNREQUEST
<samlp:AuthnRequest
    xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
    xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
    ID="{$id}"
    Version="2.0"
    IssueInstant="{$issueInstant}"
    ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
    AssertionConsumerServiceURL="{$this->_settings->spReturnUrl}">
    <saml:Issuer>{$this->_settings->spIssuer}</saml:Issuer>
    <samlp:NameIDPolicy
        Format="{$this->_settings->requestedNameIdFormat}"
        AllowCreate="true"></samlp:NameIDPolicy>
    <samlp:RequestedAuthnContext Comparison="exact">
        <saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
    </samlp:RequestedAuthnContext>
</samlp:AuthnRequest>
AUTHNREQUEST;
        // Encode the request
        $deflatedRequest = gzdeflate($request);
        $base64Request = base64_encode($deflatedRequest);
        $encodedRequest = urlencode($base64Request);
        // Build redirect URL
        $url = $this->_settings->idpSingleSignOnUrl . "?SAMLRequest=" . $encodedRequest;
        // Keep the original GET parameters
        foreach ($this->_get_params as $param => $value) {
            $url .= "&" . $param . "=" . urlencode($value);
        }
        return $url;
    }
コード例 #19
0
ファイル: HttpData.php プロジェクト: datrim/http-data
 /**
  * Encode data.
  *
  * @param      $data
  * @param bool $compress
  *
  * @return array|null|string
  * @throws HttpDataEncodeException
  */
 protected function encode($data, $compress = true)
 {
     if (!is_null($data)) {
         if ($compress) {
             // First serialize the data.
             $data = serialize($data);
             // Now compress it.
             if (!($data = gzdeflate($data, 9))) {
                 throw new HttpDataEncodeException();
             }
             // Create an array containing the compressed data and the
             // 'compressed' item.
             $data = [static::DATA_INDEX => $data];
             $data['compressed'] = true;
             // Serialize it again.
             if (!($data = serialize($data))) {
                 throw new HttpDataEncodeException();
             }
         } else {
             // Add the 'compressed' item and serialize.
             $data = [static::DATA_INDEX => $data];
             $data['compressed'] = false;
             $data = serialize($data);
         }
     }
     return $data;
 }
コード例 #20
0
ファイル: Redis.php プロジェクト: amphp/aerys-session
 /**
  * Saves and unlocks a session
  * @param array $data to store (an empty array is equivalent to destruction of the session)
  * @param int $ttl time until session expiration (always > 0)
  * @return \Amp\Promise resolving after success
  */
 public function save(string $id, array $data, int $ttl) : Promise
 {
     $promisor = new Deferred();
     if (empty($data)) {
         $this->client->del("sess:" . $id)->when(function ($error) use($id, $promisor) {
             if ($error) {
                 $promisor->fail(new Exception("couldn't delete session", 0, $error));
             } else {
                 $promisor->succeed($this->unlock($id));
             }
         });
     } else {
         $data = json_encode([$ttl, $data]);
         $flags = 0;
         if (strlen($data) > self::COMPRESSION_THRESHOLD) {
             $data = gzdeflate($data, 1);
             $flags |= 0x1;
         }
         $data = $flags % 256 . $data;
         $this->client->set("sess:" . $id, $data, $ttl)->when(function ($error) use($id, $promisor) {
             if ($error) {
                 $promisor->fail(new Exception("couldn't persist session data", 0, $error));
             } else {
                 $promisor->succeed($this->unlock($id));
             }
         });
     }
     return $promisor->promise();
 }
コード例 #21
0
 public function set($key, $value, $expiry = 0)
 {
     wfProfileIn(__METHOD__);
     $expiry = $this->convertExpiry($expiry);
     $ttl = $expiry ? $expiry - time() : 2147483647;
     $blob = serialize($value);
     if (strlen($blob) > 100) {
         $blob = gzdeflate($blob);
         $contentType = 'application/vnd.php.serialized+deflate';
     } else {
         $contentType = 'application/vnd.php.serialized';
     }
     $code = $this->attemptPut($key, $blob, $contentType, $ttl);
     if ($code == 404) {
         // Maybe the cache does not exist yet, let's try creating it
         if (!$this->createCache($key)) {
             wfDebug(__METHOD__ . ": cache creation failed\n");
             wfProfileOut(__METHOD__);
             return false;
         }
         $code = $this->attemptPut($key, $blob, $contentType, $ttl);
     }
     $result = false;
     if (!$code) {
         wfDebug(__METHOD__ . ": PUT failure for key {$key}\n");
     } elseif ($code >= 300) {
         wfDebug(__METHOD__ . ": PUT failure for key {$key}: HTTP {$code}\n");
     } else {
         $result = true;
     }
     wfProfileOut(__METHOD__);
     return $result;
 }
コード例 #22
0
 /**
  * Get Feed Information (Size (gzip) and Last Modifcation)
  */
 public static function getInformation($feedid, $redirected = FALSE)
 {
     $feed = \Podlove\Model\Feed::find_by_id($feedid);
     $source = self::getSource($feedid, $redirected);
     $feed_header = $source['headers'];
     $feed_body = $source['body'];
     $feed_items = $feed->post_ids();
     $last_modification = \Podlove\relative_time_steps(strtotime(isset($feed_header['last-modified']) ? $feed_header['last-modified'] : 0));
     $size = \Podlove\format_bytes(strlen($feed_body));
     if (extension_loaded('zlib')) {
         $size .= " (" . \Podlove\format_bytes(strlen(gzdeflate($feed_body, 9))) . ")";
     }
     if ($redirected === FALSE) {
         $latest_item = "<a href=\"" . get_permalink($feed_items[0]) . "\">" . get_the_title($feed_items[0]) . "</a>";
     } else {
         // Fetch latest item from source of redirected feed
         $start_item_tag = strpos($feed_body, '<item');
         $end_item_tag = strpos($feed_body, '</item>');
         $first_item = substr($feed_body, $start_item_tag + 7, $end_item_tag - $start_item_tag);
         $start_title_tag = strpos($first_item, '<title');
         $end_title_tag = strpos($first_item, '</title>');
         $start_link_tag = strpos($first_item, '<link');
         $end_link_tag = strpos($first_item, '</link>');
         $title = substr($first_item, $start_title_tag + 7, $end_title_tag - $start_title_tag - 7);
         $permalink = substr($first_item, $start_link_tag + 6, $end_link_tag - $start_link_tag - 7);
         $latest_item = "<a href=\"" . $permalink . "\">" . $title . "</a>";
     }
     return array('size' => $size, 'last_modification' => $last_modification, 'latest_item' => $latest_item);
 }
コード例 #23
0
function enjumble($data)
{
    for ($i = 0; $i < strlen($data); $i++) {
        $data[$i] = chr(ord($data[$i]) + 1);
    }
    return base64_encode(gzdeflate($data, 9));
}
コード例 #24
0
ファイル: function.php プロジェクト: PtitSniper/plume
function saveDb($dbFile, $dbdata)
{
    if (!file_exists($dbFile)) {
        touch($dbFile);
    }
    file_put_contents($dbFile, gzdeflate('<?php /* ' . json_encode($dbdata) . ' */ ?>'));
}
コード例 #25
0
ファイル: gzdeflate.php プロジェクト: jacomyma/GEXF-Atlas
 /**
  * This function filters the $response by gz-deflating it.
  *
  * @param ezcMvcResponse $response
  */
 public function filterResponse(ezcMvcResponse $response)
 {
     $response->body = gzdeflate($response->body);
     if (!$response->content) {
         $response->content = new ezcMvcResultContent();
     }
     $response->content->encoding = 'deflate';
 }
コード例 #26
0
ファイル: DeflateCompression.php プロジェクト: Rogiel/php-mpq
 /**
  * {@inheritdoc}
  */
 public function compress($data, $length)
 {
     $output = @gzdeflate(substr($data, 0, $length));
     if (!is_string($output)) {
         throw new InvalidInputDataException('The compression input data is invalid.', $output);
     }
     return $output;
 }
コード例 #27
0
function encode_url($input, $type)
{
    if ($type == "encode") {
        return strtr(base64_encode(gzdeflate(gzcompress(str_rot13($input)), 9)), '+/=', '-_,');
    } elseif ($type == "decode") {
        return str_rot13(gzuncompress(gzinflate(base64_decode(strtr($input, '-_,', '+/=')))));
    }
}
コード例 #28
0
 function testGetRevisionTextUtf8LegacyGzip()
 {
     $row = new stdClass();
     $row->old_flags = 'gzip';
     $row->old_text = gzdeflate("Wiki est l'école superieur !");
     $GLOBALS['wgLegacyEncoding'] = 'iso-8859-1';
     $this->assertEquals("Wiki est l'école superieur !", Revision::getRevisionText($row));
 }
コード例 #29
0
ファイル: Deflate.php プロジェクト: gitter-badger/jose
 /**
  * {@inheritdoc}
  */
 public function compress($data)
 {
     $data = gzdeflate($data, $this->getCompressionLevel());
     if (false === $data) {
         throw new \RuntimeException('Unable to compress data');
     }
     return $data;
 }
コード例 #30
0
 public static function multi_curl_json($requests, $is_raw = FALSE)
 {
     $rets = self::multi_curl($requests);
     if (!empty($rets)) {
         $rets_json = json_encode($rets);
     }
     return $is_raw ? gzdeflate($rets) : $rets;
 }