當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Convert::base64url_decode方法代碼示例

本文整理匯總了PHP中Convert::base64url_decode方法的典型用法代碼示例。如果您正苦於以下問題:PHP Convert::base64url_decode方法的具體用法?PHP Convert::base64url_decode怎麽用?PHP Convert::base64url_decode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Convert的用法示例。


在下文中一共展示了Convert::base64url_decode方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getGeneratedImages

 /**
  * Generate a list of images that were generated from this image
  */
 private function getGeneratedImages()
 {
     $generatedImages = array();
     $cachedFiles = array();
     $folder = $this->ParentID ? $this->Parent()->Filename : ASSETS_DIR . '/';
     $cacheDir = Director::getAbsFile($folder . '_resampled/');
     if (is_dir($cacheDir)) {
         if ($handle = opendir($cacheDir)) {
             while (($file = readdir($handle)) !== false) {
                 // ignore all entries starting with a dot
                 if (substr($file, 0, 1) != '.' && is_file($cacheDir . $file)) {
                     $cachedFiles[] = $file;
                 }
             }
             closedir($handle);
         }
     }
     $pattern = $this->getFilenamePatterns($this->Name);
     foreach ($cachedFiles as $cfile) {
         if (preg_match($pattern['FullPattern'], $cfile, $matches)) {
             if (Director::fileExists($cacheDir . $cfile)) {
                 $subFilename = substr($cfile, 0, -1 * strlen($this->Name));
                 preg_match_all($pattern['GeneratorPattern'], $subFilename, $subMatches, PREG_SET_ORDER);
                 $generatorArray = array();
                 foreach ($subMatches as $singleMatch) {
                     $generatorArray[] = array('Generator' => $singleMatch['Generator'], 'Args' => Convert::base64url_decode($singleMatch['Args']));
                 }
                 // Using array_reverse is important, as a cached image will
                 // have the generators settings in the filename in reversed
                 // order: the last generator given in the filename is the
                 // first that was used. Later resizements are prepended
                 $generatedImages[] = array('FileName' => $cacheDir . $cfile, 'Generators' => array_reverse($generatorArray));
             }
         }
     }
     return $generatedImages;
 }
開發者ID:miamollie,項目名稱:echoAerial,代碼行數:40,代碼來源:Image.php

示例2: testBase64url

 /**
  * Tests {@link Convert::base64url_encode()} and {@link Convert::base64url_decode()}
  */
 public function testBase64url()
 {
     $data = 'Wëīrð characters ☺ such as ¤Ø¶÷╬';
     // This requires this test file to have UTF-8 character encoding
     $this->assertEquals($data, Convert::base64url_decode(Convert::base64url_encode($data)));
     $data = 654.423;
     $this->assertEquals($data, Convert::base64url_decode(Convert::base64url_encode($data)));
     $data = true;
     $this->assertEquals($data, Convert::base64url_decode(Convert::base64url_encode($data)));
     $data = array('simple', 'array', '¤Ø¶÷╬');
     $this->assertEquals($data, Convert::base64url_decode(Convert::base64url_encode($data)));
     $data = array('a' => 'associative', 4 => 'array', '☺' => '¤Ø¶÷╬');
     $this->assertEquals($data, Convert::base64url_decode(Convert::base64url_encode($data)));
 }
開發者ID:jacobbuck,項目名稱:silverstripe-framework,代碼行數:17,代碼來源:ConvertTest.php

示例3: getGeneratedImages

 /**
  * Generate a list of images that were generated from this image
  *
  * @return array
  */
 protected function getGeneratedImages()
 {
     $generatedImages = array();
     $cachedFiles = array();
     $folder = $this->ParentID ? $this->Parent()->Filename : ASSETS_DIR . '/';
     $cacheDir = Director::getAbsFile($folder . '_resampled/');
     // Find all paths with the same filename as this Image (the path contains the transformation info)
     if (is_dir($cacheDir)) {
         $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($cacheDir));
         foreach ($files as $path => $file) {
             if ($file->getFilename() == $this->Name) {
                 $cachedFiles[] = $path;
             }
         }
     }
     $pattern = $this->getFilenamePatterns($this->Name);
     // Reconstruct the image transformation(s) from the format-folder(s) in the path
     // (if chained, they contain the transformations in the correct order)
     foreach ($cachedFiles as $cf_path) {
         if (($pos = stripos($cf_path, '_resampled')) === false) {
             continue;
         }
         $cf_generated = substr($cf_path, $pos + strlen('_resampled'));
         preg_match_all($pattern['GeneratorPattern'], $cf_generated, $matches, PREG_SET_ORDER);
         $generatorArray = array();
         foreach ($matches as $singleMatch) {
             $generatorArray[] = array('Generator' => $singleMatch['Generator'], 'Args' => Convert::base64url_decode($singleMatch['Args']) ?: array());
         }
         $generatedImages[] = array('FileName' => $cf_path, 'Generators' => $generatorArray);
     }
     return $generatedImages;
 }
開發者ID:hpeide,項目名稱:silverstripe-framework,代碼行數:37,代碼來源:Image.php


注:本文中的Convert::base64url_decode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。