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


PHP Zend_Pdf_Element_String::unescape方法代碼示例

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


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

示例1: testUnescapeOctal

 /**
  * @group ZF-9450
  */
 public function testUnescapeOctal()
 {
     $input = array(0304 => '\\304', 0326 => '\\326', 0334 => '\\334');
     foreach ($input as $k => $v) {
         $this->assertEquals(Zend_Pdf_Element_String::unescape($v), chr($k), 'expected German Umlaut');
     }
 }
開發者ID:netvlies,項目名稱:zf,代碼行數:10,代碼來源:StringTest.php

示例2: _readString

 /**
  * Read string PDF object
  * Also reads trailing ')' from a pdf stream
  *
  * @return Zend_Pdf_Element_String
  * @throws Zend_Pdf_Exception
  */
 private function _readString()
 {
     $start = $this->offset;
     $openedBrackets = 1;
     $this->offset += strcspn($this->data, '()\\', $this->offset);
     while ($this->offset < strlen($this->data)) {
         switch (ord($this->data[$this->offset])) {
             case 0x28:
                 // '(' - opened bracket in the string, needs balanced pair.
                 $this->offset++;
                 $openedBrackets++;
                 break;
             case 0x29:
                 // ')' - pair to the opened bracket
                 $this->offset++;
                 $openedBrackets--;
                 break;
             case 0x5c:
                 // '\\' - escape sequence, skip next char from a check
                 $this->offset += 2;
         }
         if ($openedBrackets == 0) {
             break;
             // end of string
         }
         $this->offset += strcspn($this->data, '()\\', $this->offset);
     }
     if ($openedBrackets != 0) {
         require_once 'Zend/Pdf/Exception.php';
         throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Unexpected end of file while string reading. Offset - 0x%X. \')\' expected.', $start));
     }
     return new Zend_Pdf_Element_String(Zend_Pdf_Element_String::unescape(substr($this->data, $start, $this->offset - $start - 1)));
 }
開發者ID:travisj,項目名稱:zf,代碼行數:40,代碼來源:StringParser.php

示例3: testUnescape

 public function testUnescape()
 {
     $this->assertEquals(Zend_Pdf_Element_String::unescape("\\n\\r\\t\\b\\f\\(\\)\\\\  \nsome \\\ntext"), "\n\r\t\f()\\  \nsome text");
 }
開發者ID:lortnus,項目名稱:zf1,代碼行數:4,代碼來源:StringTest.php

示例4: _readString

 /**
  * Read string PDF object
  * Also reads trailing ')' from a pdf stream
  *
  * @return Zend_Pdf_Element_String
  * @throws Zend_Pdf_Exception
  */
 private function _readString()
 {
     $start = $this->_current;
     $openedBrackets = 1;
     while ($this->_current < strlen($this->_pdfString)) {
         switch (ord($this->_pdfString[$this->_current])) {
             case 0x28:
                 // '(' - opened bracket in the string, needs balanced pair.
                 $openedBrackets++;
                 break;
             case 0x29:
                 // ')' - pair to the opened bracket
                 $openedBrackets--;
                 break;
             case 0x5c:
                 // '\\' - escape sequence, skip next char from a check
                 $this->_current++;
         }
         $this->_current++;
         if ($openedBrackets == 0) {
             break;
             // end of string
         }
     }
     if ($openedBrackets != 0) {
         throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Unexpected end of file while string reading. Offset - 0x%X. \')\' expected.', $start));
     }
     return new Zend_Pdf_Element_String(Zend_Pdf_Element_String::unescape(substr($this->_pdfString, $start, $this->_current - $start - 1)));
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:36,代碼來源:Parser.php

示例5: _readString

 private function _readString()
 {
     $start = $this->offset;
     $openedBrackets = 1;
     $this->offset += strcspn($this->data, '()\\', $this->offset);
     while ($this->offset < strlen($this->data)) {
         switch (ord($this->data[$this->offset])) {
             case 0x28:
                 $this->offset++;
                 $openedBrackets++;
                 break;
             case 0x29:
                 $this->offset++;
                 $openedBrackets--;
                 break;
             case 0x5c:
                 $this->offset += 2;
         }
         if ($openedBrackets == 0) {
             break;
         }
         $this->offset += strcspn($this->data, '()\\', $this->offset);
     }
     if ($openedBrackets != 0) {
         throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Unexpected end of file while string reading. Offset - 0x%X. \')\' expected.', $start));
     }
     return new Zend_Pdf_Element_String(Zend_Pdf_Element_String::unescape(substr($this->data, $start, $this->offset - $start - 1)));
 }
開發者ID:subashemphasize,項目名稱:test_site,代碼行數:28,代碼來源:Pdf_Pack.php


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