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


PHP ctype_print函数代码示例

本文整理汇总了PHP中ctype_print函数的典型用法代码示例。如果您正苦于以下问题:PHP ctype_print函数的具体用法?PHP ctype_print怎么用?PHP ctype_print使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: json

 /**
  * JSON encode a PHP value.
  *
  * @param {void*} $value Any arbitrary PHP value.
  * @return {string} JSON representation of specified PHP value.
  */
 public static function json($value)
 {
     // note: binary strings will fuck up the encoding process, remove them.
     $maskBinary = function (&$value) use(&$maskBinary) {
         if ($value instanceof \JsonSerializable) {
             $value = $value->jsonSerialize();
         }
         if (is_object($value)) {
             foreach (get_object_vars($value) as $key => $_value) {
                 $maskBinary($value->{$key});
             }
             unset($_value);
         } else {
             if (is_array($value)) {
                 array_walk($value, $maskBinary);
             } else {
                 if (is_string($value) && $value && !ctype_print($value) && json_encode($value) === false) {
                     $value = '[binary string]';
                 }
             }
         }
     };
     $maskBinary($value);
     return json_encode($value);
 }
开发者ID:Victopia,项目名称:prefw,代码行数:31,代码来源:ContentEncoder.php

示例2: __construct

 /**
  * Constructor
  *
  * @param  array $config Configuration settings:
  *    'realm' => <string>
  *    'identity' => <string> The identity to match
  *    'credential' => <string> The credential to match
  * @throws Zend_Auth_Adapter_Exception
  * @return void
  */
 public function __construct(array $config)
 {
     if (empty($config['identity'])) {
         throw new Zend_Auth_Adapter_Exception('Config key identity is required');
     } else {
         $this->_identity = $config['identity'];
     }
     if (empty($config['credential'])) {
         throw new Zend_Auth_Adapter_Exception('Config key credential is required');
     } else {
         $this->_credential = $config['credential'];
     }
     // Taken from Zend_Auth_Adapter_Http
     // Double-quotes are used to delimit the realm string in the HTTP header,
     // and colons are field delimiters in the password file.
     if (empty($config['realm']) || !ctype_print($config['realm']) || strpos($config['realm'], ':') !== false || strpos($config['realm'], '"') !== false) {
         /**
          * @see Zend_Auth_Adapter_Exception
          */
         require_once 'Zend/Auth/Adapter/Exception.php';
         throw new Zend_Auth_Adapter_Exception('Config key \'realm\' is required, and must contain only printable ' . 'characters, excluding quotation marks and colons');
     } else {
         $this->_realm = $config['realm'];
     }
 }
开发者ID:johannilsson,项目名称:yag,代码行数:35,代码来源:Wsse.php

示例3: setLabel

 /**
  * @param string $label
  *
  * @return AccessTokenInterface
  */
 public function setLabel($label)
 {
     if (!empty($label) && is_string($label) && ctype_print($label)) {
         $this->label = trim($label);
     }
     return $this;
 }
开发者ID:bitpay,项目名称:xcart-plugin,代码行数:12,代码来源:AccessToken.php

示例4: authenticate

 /**
  * Performs an authentication attempt
  *
  * @return \Zend\Authentication\Result
  * @throws \Zend\Authentication\Adapter\Exception\ExceptionInterface If authentication cannot be performed
  */
 public function authenticate()
 {
     $getHeader = $this->options['proxy_auth'] ? 'Proxy-Authorization' : 'Authorization';
     if (!($authHeader = $this->request->headers->get($getHeader))) {
         return $this->challengeClient();
     }
     // Decode the Authorization header
     $authorizationHeader = base64_decode(substr($authHeader, strlen('Basic ')));
     if (!$authorizationHeader) {
         throw new RuntimeException('Unable to base64_decode Authorization header value');
     }
     // See ZF-1253. Validate the credentials the same way the digest
     // implementation does. If invalid credentials are detected,
     // re-challenge the client.
     if (!ctype_print($authorizationHeader)) {
         return $this->challengeClient();
     }
     // Fix for ZF-1515: Now re-challenges on empty username or password
     $credentials = array_filter(explode(':', $authorizationHeader));
     if (count($credentials) !== 2) {
         return $this->challengeClient();
     }
     $result = $this->resolver->resolve($credentials[0], $this->options['realm'], $credentials[1]);
     if ($result instanceof Result && $result->isValid()) {
         return $result;
     }
     if (!$result instanceof Result && !is_array($result) && Utils::compareStrings($result, $credentials[1])) {
         $identity = ['username' => $credentials[0], 'realm' => $this->options['realm']];
         return new Result(Result::SUCCESS, $identity);
     } elseif (is_array($result)) {
         return new Result(Result::SUCCESS, $result);
     }
     return $this->challengeClient();
 }
开发者ID:sunnyct,项目名称:silexcmf-zend-authentication,代码行数:40,代码来源:HttpBasic.php

示例5: fromSong

 /**
  * Generate the downloadable path for a song.
  *
  * @param Song $song
  *
  * @return string
  */
 protected function fromSong(Song $song)
 {
     if ($s3Params = $song->s3_params) {
         // The song is hosted on Amazon S3.
         // We download it back to our local server first.
         $localPath = rtrim(sys_get_temp_dir(), '/') . '/' . basename($s3Params['key']);
         $url = $song->getObjectStoragePublicUrl();
         abort_unless($url, 404);
         // The following function require allow_url_fopen to be ON.
         // We're just assuming that to be the case here.
         copy($url, $localPath);
     } else {
         // The song is hosted locally. Make sure the file exists.
         abort_unless(file_exists($song->path), 404);
         $localPath = $song->path;
     }
     // The BinaryFileResponse factory only accept ASCII-only file names.
     if (ctype_print($localPath)) {
         return $localPath;
     }
     // For those with high-byte characters in names, we copy it into a safe name
     // as a workaround.
     $newPath = rtrim(sys_get_temp_dir(), '/') . '/' . utf8_decode(basename($song->path));
     if ($s3Params) {
         // If the file is downloaded from S3, we rename it directly.
         // This will save us some disk space.
         rename($localPath, $newPath);
     } else {
         // Else we copy it to another file to not mess up the original one.
         copy($localPath, $newPath);
     }
     return $newPath;
 }
开发者ID:phanan,项目名称:koel,代码行数:40,代码来源:Download.php

示例6: insertAll

 public function insertAll($rows)
 {
     $generic = Factory::getGeneric();
     $rowsSql = array();
     foreach ($rows as $row) {
         $values = array();
         foreach ($row as $name => $value) {
             if (is_null($value)) {
                 $values[] = 'NULL';
             } else {
                 if (is_numeric($value)) {
                     $values[] = $value;
                 } else {
                     if (!ctype_print($value)) {
                         $values[] = $generic->bin2dbRawInsert($value);
                     } else {
                         if (is_bool($value)) {
                             $values[] = $value ? '1' : '0';
                         } else {
                             $values[] = "'{$value}'";
                         }
                     }
                 }
             }
         }
         $rowsSql[] = "(" . implode(',', $values) . ")";
     }
     $sql = 'INSERT INTO ' . $this->table . ' VALUES ' . implode(',', $rowsSql);
     $this->db->query($sql);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:30,代码来源:Base.php

示例7: read

 /**
  * {@inheritdoc}
  */
 public function read($filename)
 {
     $meta = new ValueBag();
     try {
         $fileEntity = $this->reader->reset()->files($filename)->first();
     } catch (\Exception $e) {
         return $meta;
     }
     if ($fileEntity->getMetadatas()->containsKey('File:ImageWidth')) {
         $meta->set('image.width', new MetaValue((int) $fileEntity->getMetadatas()->get('File:ImageWidth')->getValue()->asString()));
     } elseif ($fileEntity->getMetadatas()->containsKey('PNG:ImageWidth')) {
         $meta->set('image.width', new MetaValue((int) $fileEntity->getMetadatas()->get('PNG:ImageWidth')->getValue()->asString()));
     }
     if ($fileEntity->getMetadatas()->containsKey('File:ImageHeight')) {
         $meta->set('image.height', new MetaValue((int) $fileEntity->getMetadatas()->get('File:ImageHeight')->getValue()->asString()));
     } elseif ($fileEntity->getMetadatas()->containsKey('PNG:ImageHeight')) {
         $meta->set('image.height', new MetaValue((int) $fileEntity->getMetadatas()->get('PNG:ImageHeight')->getValue()->asString()));
     }
     foreach ($fileEntity->getMetadatas() as $metadata) {
         /* @var $metadata Metadata */
         if (ValueInterface::TYPE_BINARY === $metadata->getValue()->getType()) {
             continue;
         }
         $groupName = $metadata->getTag()->getGroupName();
         $name = $metadata->getTag()->getName();
         $value = (string) $metadata->getValue();
         if ($groupName === 'System' || !ctype_print($value)) {
             continue;
         }
         $path = "{$groupName}.{$name}";
         $meta->set($path, new MetaValue($value));
     }
     return $meta;
 }
开发者ID:temp,项目名称:meta-reader,代码行数:37,代码来源:ExiftoolReader.php

示例8: isValid

 public function isValid($value)
 {
     if (ctype_print($value)) {
         return true;
     }
     $this->setError("invalid");
     return false;
 }
开发者ID:TheSavior,项目名称:Saros-Framework,代码行数:8,代码来源:Visible.php

示例9: create

 /**
  * Static function to create a new Imagecow instance from an image file or string
  *
  * @param string $image   The name of the image file or binary string
  * @param string $library The name of the image library to use (Gd or Imagick). If it's not defined, detects automatically the library to use.
  *
  * @return Image The Imagecow instance
  */
 public static function create($image, $library = null)
 {
     //check if it's a binary string
     if (!ctype_print($image)) {
         return static::createFromString($image, $library);
     }
     return static::createFromFile($image, $library);
 }
开发者ID:marcha,项目名称:imagecow,代码行数:16,代码来源:Image.php

示例10: getAcceptLanguage

 /**
  * Retrieve accept language
  *
  * @return string
  */
 protected function getAcceptLanguage()
 {
     $acceptLanguage = empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? null : $_SERVER['HTTP_ACCEPT_LANGUAGE'];
     if (!ctype_print($acceptLanguage)) {
         $acceptLanguage = null;
     }
     return $acceptLanguage;
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:13,代码来源:Visitor.php

示例11: testGenerateToken

 public function testGenerateToken()
 {
     $token = $this->generator->generateToken();
     $this->assertTrue(ctype_print($token), 'is printable');
     $this->assertStringNotMatchesFormat('%S+%S', $token, 'is URI safe');
     $this->assertStringNotMatchesFormat('%S/%S', $token, 'is URI safe');
     $this->assertStringNotMatchesFormat('%S=%S', $token, 'is URI safe');
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:8,代码来源:UriSafeTokenGeneratorTest.php

示例12: extract

 /**
  * Helper function to transform the ip and format it correctly for extraction.
  * If inputted with a string, it will leave it the same.
  * If inputted with a binary string, it will output an unpacked human readable string.
  *
  * @return $ip string
  */
 public function extract($ip)
 {
     //human readable string
     if (ctype_print($ip)) {
         return $ip;
     }
     return inet_ntop($ip);
 }
开发者ID:polycademy,项目名称:polyauth,代码行数:15,代码来源:IpTransformer.php

示例13: find

 /**
  * Modified find static function to accept both string and binary versions of uuid
  * @param  mixed $id       The id (binary or hex string)
  * @param  array $columns  The columns to be returned (defaults to *)
  * @return mixed           The model or null
  */
 public static function find($id, $columns = array('*'))
 {
     if (ctype_print($id)) {
         return static::where('id', '=', hex2bin($id))->first($columns);
     } else {
         return parent::where('id', '=', $id)->first($columns);
     }
 }
开发者ID:dannyweeks,项目名称:eloquent-uuid,代码行数:14,代码来源:UuidBinaryModelTrait.php

示例14: findOrFail

 /**
  * Modified findOrFail static function to accept both string and binary versions of uuid
  * @param  mixed $id       The id (binary or hex string)
  * @param  array $columns  The columns to be returned (defaults to *)
  * @return mixed           The model or null
  */
 public static function findOrFail($id, $columns = array('*'))
 {
     if (ctype_print($id)) {
         $idFinal = property_exists(static::class, 'uuidOptimization') && static::$uuidOptimization ? self::toOptimized($id) : hex2bin($id);
         return static::where('id', '=', $idFinal)->firstOrFail($columns);
     } else {
         return parent::where('id', '=', $id)->firstOrFail($columns);
     }
 }
开发者ID:alsofronie,项目名称:eloquent-uuid,代码行数:15,代码来源:UuidBinaryModelTrait.php

示例15: __construct

 /**
  * @param string $type    type of MFA, used in audit logs
  * @param string $message user-friendly message used in player kick message
  * @param string $data    printable, single-line string used in audit logs as data for this
  *
  * @throws \InvalidArgumentException if $data is not printable or single-line
  */
 public function __construct($type, $message, $data = "")
 {
     if (!ctype_print($data)) {
         throw new \InvalidArgumentException("\$data is not printable");
     }
     $this->type = $type;
     $this->message = $message;
     $this->data = $data;
 }
开发者ID:PEMapModder,项目名称:HereAuth,代码行数:16,代码来源:MultiFactorAuthFailure.php


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