idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
34,700 | public function make ( array $ config ) : Vimeo { $ config = $ this -> getConfig ( $ config ) ; return $ this -> getClient ( $ config ) ; } | Make a new Vimeo client . |
34,701 | public function send ( ) { $ vars = $ this -> templateContainer -> getTemplateVars ( ) ; $ this -> checkInvoice ( $ vars ) ; parent :: send ( ) ; } | Add attachment to the main mail |
34,702 | public function processTemplate ( ) { $ isDesignApplied = $ this -> applyDesignConfig ( ) ; $ processor = $ this -> getTemplateFilter ( ) -> setUseSessionInUrl ( false ) -> setPlainTemplateMode ( $ this -> isPlain ( ) ) -> setIsChildTemplate ( $ this -> isChildTemplate ( ) ) -> setTemplateProcessor ( [ $ this , 'getTem... | Get processed template |
34,703 | public function getDesignConfig ( ) { $ templates = $ this -> getTemplate ( ) -> getData ( 'store_id' ) ; $ this -> storeId = $ templates [ 0 ] ; if ( $ this -> designConfig === null ) { $ this -> designConfig = new DataObject ( [ 'area' => Area :: AREA_FRONTEND , 'store' => $ this -> storeId ] ) ; } return $ this -> d... | Get design configuration data |
34,704 | public function execute ( ) { $ id = $ this -> getRequest ( ) -> getParam ( 'template_id' ) ; if ( $ id ) { $ model = $ this -> templateRepository -> getById ( $ id ) ; if ( ! $ model -> getId ( ) ) { $ this -> messageManager -> addErrorMessage ( __ ( 'This post no longer exists.' ) ) ; $ resultRedirect = $ this -> res... | Edit PDF Templates |
34,705 | public function execute ( ) { $ template = $ this -> _initTemplate ( ) ; try { $ parts = $ this -> emailConfig -> parseTemplateIdParts ( self :: INVOICE_TMEPLTE_ID ) ; $ templateId = $ parts [ 'templateId' ] ; $ theme = $ parts [ 'theme' ] ; if ( $ theme ) { $ template -> setForcedTheme ( $ templateId , $ theme ) ; } $... | WYSIWYG Plugin Action |
34,706 | public function lookupStoreIds ( $ templateId ) { $ adapter = $ this -> getConnection ( ) ; $ select = $ adapter -> select ( ) -> from ( $ this -> getTable ( 'eadesign_pdf_store' ) , 'store_id' ) -> where ( 'template_id = ?' , ( int ) $ templateId ) ; return $ adapter -> fetchCol ( $ select ) ; } | Get store ids to which specified item is assigned |
34,707 | public function addFieldToFilter ( $ field , $ condition = null ) { if ( $ field === 'store_id' ) { return $ this -> addStoreFilter ( $ condition , false ) ; } return parent :: addFieldToFilter ( $ field , $ condition ) ; } | Add field filter to collection |
34,708 | public function performAddStoreFilter ( $ store , $ withAdmin = true ) { if ( $ store instanceof Store ) { $ store = [ $ store -> getId ( ) ] ; } if ( ! is_array ( $ store ) ) { $ store = [ $ store ] ; } if ( $ withAdmin ) { $ store [ ] = Store :: DEFAULT_STORE_ID ; } $ this -> addFilter ( 'store' , [ 'in' => $ store ]... | Perform adding filter by store |
34,709 | public function isEnable ( ) { if ( ! $ this -> mPDFExists ( ) || ! $ this -> collection ( ) -> getSize ( ) ) { return false ; } return $ this -> hasConfig ( self :: ENABLE ) ; } | Check if module is enable |
34,710 | public function getTemplateStatus ( Invoice $ invoice ) { $ invoiceStore = $ invoice -> getOrder ( ) -> getStoreId ( ) ; $ collection = $ this -> collection ( ) ; $ collection -> addStoreFilter ( $ invoiceStore ) ; $ collection -> addFieldToFilter ( 'is_active' , TemplateActive :: STATUS_ENABLED ) ; $ collection -> add... | Get the active template |
34,711 | public function getAvailable ( ) { return [ self :: TEMAPLATE_PAPER_FORM_A4 => 'A4' , self :: TEMAPLATE_PAPER_FORMAT_A3 => 'A3' , self :: TEMAPLATE_PAPER_FORMAT_A5 => 'A5' , self :: TEMAPLATE_PAPER_FORMAT_A6 => 'A6' , self :: TEMAPLATE_PAPER_FORMAT_LETTER => 'Letter' , self :: TEMAPLATE_PAPER_FORMAT_LEGAL => 'Legal' , ... | Prepare post s statuses . |
34,712 | public function template2Pdf ( ) { $ parts = $ this -> transport ( ) ; $ applySettings = $ this -> eaPDFSettings ( $ parts ) ; $ fileParts = [ 'filestream' => $ applySettings , 'filename' => filter_var ( $ parts [ 'filename' ] , FILTER_SANITIZE_URL ) ] ; return $ fileParts ; } | Filename of the pdf and the stream to sent to the download |
34,713 | public function flush ( ) { $ count = count ( $ this -> queue ) ; $ success = true ; while ( $ count > 0 && $ success ) { $ batch = array_splice ( $ this -> queue , 0 , min ( $ this -> batch_size , $ count ) ) ; $ success = $ this -> flushBatch ( $ batch ) ; $ count = count ( $ this -> queue ) ; } return $ success ; } | Flushes our queue of messages by batching them to the server |
34,714 | protected function enqueue ( $ item ) { $ count = count ( $ this -> queue ) ; if ( $ count > $ this -> max_queue_size ) { return false ; } $ count = array_push ( $ this -> queue , $ item ) ; if ( $ count >= $ this -> batch_size ) { return $ this -> flush ( ) ; } return true ; } | Adds an item to our queue . |
34,715 | public function flushBatch ( $ messages ) { $ body = $ this -> payload ( $ messages ) ; $ payload = json_encode ( $ body ) ; $ payload = escapeshellarg ( $ payload ) ; $ secret = $ this -> secret ; $ protocol = $ this -> ssl ( ) ? "https://" : "http://" ; if ( $ this -> host ) { $ host = $ this -> host ; } else { $ hos... | Make an async request to our API . Fork a curl process immediately send to the API . If debug is enabled we wait for the response . |
34,716 | public function flushBatch ( $ messages ) { $ body = $ this -> payload ( $ messages ) ; $ payload = json_encode ( $ body ) ; $ secret = $ this -> secret ; if ( strlen ( $ payload ) >= 32 * 1024 ) { if ( $ this -> debug ( ) ) { $ msg = "Message size is larger than 32KB" ; error_log ( "[Analytics][" . $ this -> type . "]... | Make a sync request to our API . If debug is enabled we wait for the response and retry once to diminish impact on performance . |
34,717 | public function page ( array $ message ) { $ message = $ this -> message ( $ message , "properties" ) ; $ message [ "type" ] = "page" ; return $ this -> consumer -> page ( $ message ) ; } | Tracks a page view . |
34,718 | public function screen ( array $ message ) { $ message = $ this -> message ( $ message , "properties" ) ; $ message [ "type" ] = "screen" ; return $ this -> consumer -> screen ( $ message ) ; } | Tracks a screen view . |
34,719 | public function alias ( array $ message ) { $ message = $ this -> message ( $ message ) ; $ message [ "type" ] = "alias" ; return $ this -> consumer -> alias ( $ message ) ; } | Aliases from one user id to another |
34,720 | private function formatTime ( $ ts ) { if ( null == $ ts || ! $ ts ) { $ ts = time ( ) ; } if ( false !== filter_var ( $ ts , FILTER_VALIDATE_INT ) ) { return date ( "c" , ( int ) $ ts ) ; } if ( false === filter_var ( $ ts , FILTER_VALIDATE_FLOAT ) ) { if ( is_string ( $ ts ) ) { return date ( "c" , strtotime ( $ ts )... | Formats a timestamp by making sure it is set and converting it to iso8601 . |
34,721 | private function message ( $ msg , $ def = "" ) { if ( $ def && ! isset ( $ msg [ $ def ] ) ) { $ msg [ $ def ] = array ( ) ; } if ( $ def && empty ( $ msg [ $ def ] ) ) { $ msg [ $ def ] = ( object ) $ msg [ $ def ] ; } if ( ! isset ( $ msg [ "context" ] ) ) { $ msg [ "context" ] = array ( ) ; } $ msg [ "context" ] = ... | Add common fields to the given message |
34,722 | private static function messageId ( ) { return sprintf ( "%04x%04x-%04x-%04x-%04x-%04x%04x%04x" , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0x0fff ) | 0x4000 , mt_rand ( 0 , 0x3fff ) | 0x8000 , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0xffff ) , mt_rand ( 0 , 0xffff ) ) ; } | Generate a random messageId . |
34,723 | private function write ( $ body ) { if ( ! $ this -> file_handle ) { return false ; } $ content = json_encode ( $ body ) ; $ content .= "\n" ; return fwrite ( $ this -> file_handle , $ content ) == strlen ( $ content ) ; } | Writes the API call to a file as line - delimited json |
34,724 | protected function handleError ( $ code , $ msg ) { if ( isset ( $ this -> options [ 'error_handler' ] ) ) { $ handler = $ this -> options [ 'error_handler' ] ; $ handler ( $ code , $ msg ) ; } if ( $ this -> debug ( ) ) { error_log ( "[Analytics][" . $ this -> type . "] " . $ msg ) ; } } | On an error try and call the error handler if debugging output to error_log as well . |
34,725 | public static function init ( $ secret , $ options = array ( ) ) { self :: assert ( $ secret , "Segment::init() requires secret" ) ; self :: $ client = new Segment_Client ( $ secret , $ options ) ; } | Initializes the default client to use . Uses the libcurl consumer by default . |
34,726 | public static function screen ( array $ message ) { self :: checkClient ( ) ; self :: validate ( $ message , "screen" ) ; return self :: $ client -> screen ( $ message ) ; } | Tracks a screen view |
34,727 | public static function alias ( array $ message ) { self :: checkClient ( ) ; $ userId = ! empty ( $ message [ "userId" ] ) ; $ previousId = ! empty ( $ message [ "previousId" ] ) ; self :: assert ( $ userId && $ previousId , "Segment::alias() requires both userId and previousId" ) ; return self :: $ client -> alias ( $... | Aliases the user id from a temporary id to a permanent one |
34,728 | public static function validate ( $ msg , $ type ) { $ userId = ! empty ( $ msg [ "userId" ] ) ; $ anonId = ! empty ( $ msg [ "anonymousId" ] ) ; self :: assert ( $ userId || $ anonId , "Segment::${type}() requires userId or anonymousId" ) ; } | Validate common properties . |
34,729 | private function makeRequest ( $ socket , $ req , $ retry = true ) { $ bytes_written = 0 ; $ bytes_total = strlen ( $ req ) ; $ closed = false ; $ backoff = 100 ; while ( true ) { while ( ! $ closed && $ bytes_written < $ bytes_total ) { try { $ written = @ fwrite ( $ socket , substr ( $ req , $ bytes_written ) ) ; } c... | Attempt to write the request to the socket wait for response if debug mode is enabled . |
34,730 | private function createBody ( $ host , $ content ) { $ req = "" ; $ req .= "POST /v1/import HTTP/1.1\r\n" ; $ req .= "Host: " . $ host . "\r\n" ; $ req .= "Content-Type: application/json\r\n" ; $ req .= "Authorization: Basic " . base64_encode ( $ this -> secret . ":" ) . "\r\n" ; $ req .= "Accept: application/json\r\n"... | Create the body to send as the post request . |
34,731 | private function parseResponse ( $ res ) { $ contents = explode ( "\n" , $ res ) ; $ status = explode ( " " , $ contents [ 0 ] , 3 ) ; $ result = $ contents [ count ( $ contents ) - 1 ] ; return array ( "status" => isset ( $ status [ 1 ] ) ? $ status [ 1 ] : null , "message" => $ result ) ; } | Parse our response from the server check header and body . |
34,732 | public function setValue ( $ version = 0.0 ) { $ this -> version = $ version ; $ major = floor ( $ version ) ; $ minor = ( $ version - $ major ) * 100 ; $ strValue = sprintf ( '%02.0f%02.0f' , $ major , $ minor ) ; $ this -> components = strlen ( $ strValue ) ; $ this -> bytes = $ strValue ; } | Set the version held by this entry . |
34,733 | public function getText ( $ brief = false ) { $ v = $ this -> version ; if ( floor ( $ this -> version ) == $ this -> version ) { $ v .= '.0' ; } switch ( $ this -> tag ) { case PelTag :: EXIF_VERSION : if ( $ brief ) { return Pel :: fmt ( 'Exif %s' , $ v ) ; } else { return Pel :: fmt ( 'Exif Version %s' , $ v ) ; } b... | Return a text string with the version . |
34,734 | private function safeSetThumbnail ( PelDataWindow $ d , $ offset , $ length ) { if ( $ offset > 0 && $ length > 0 ) { if ( $ offset + $ length > $ d -> getSize ( ) ) { Pel :: maybeThrow ( new PelIfdException ( 'Thumbnail length %d bytes ' . 'adjusted to %d bytes.' , $ length , $ d -> getSize ( ) - $ offset ) ) ; $ leng... | Extract thumbnail data safely . |
34,735 | public function setThumbnail ( PelDataWindow $ d ) { $ size = $ d -> getSize ( ) ; while ( $ d -> getByte ( $ size - 2 ) != 0xFF || $ d -> getByte ( $ size - 1 ) != PelJpegMarker :: EOI ) { $ size -- ; } if ( $ size != $ d -> getSize ( ) ) { Pel :: maybeThrow ( new PelIfdException ( 'Decrementing thumbnail size ' . 'to... | Set thumbnail data . |
34,736 | public static function getTypeName ( $ type ) { switch ( $ type ) { case self :: IFD0 : return '0' ; case self :: IFD1 : return '1' ; case self :: EXIF : return 'Exif' ; case self :: GPS : return 'GPS' ; case self :: INTEROPERABILITY : return 'Interoperability' ; case self :: CANON_MAKER_NOTES : return 'Canon Maker Not... | Get the name of an IFD type . |
34,737 | public function addEntry ( PelEntry $ e ) { if ( $ this -> isValidTag ( $ e -> getTag ( ) ) ) { $ e -> setIfdType ( $ this -> type ) ; $ this -> entries [ $ e -> getTag ( ) ] = $ e ; } else { throw new PelInvalidDataException ( "IFD %s cannot hold\n%s" , $ this -> getName ( ) , $ e -> __toString ( ) ) ; } } | Adds an entry to the directory . |
34,738 | public function offsetSet ( $ tag , $ e ) { if ( $ e instanceof PelEntry ) { $ tag = $ e -> getTag ( ) ; $ this -> entries [ $ tag ] = $ e ; } else { throw new PelInvalidArgumentException ( 'Argument "%s" must be a PelEntry.' , $ e ) ; } } | Set or update a given tag in this IFD . |
34,739 | public function getEntry ( $ tag ) { if ( isset ( $ this -> entries [ $ tag ] ) ) { return $ this -> entries [ $ tag ] ; } else { return null ; } } | Retrieve an entry . |
34,740 | public function getSubIfd ( $ type ) { if ( isset ( $ this -> sub [ $ type ] ) ) { return $ this -> sub [ $ type ] ; } else { return null ; } } | Return a sub IFD . |
34,741 | public function getValue ( $ type = self :: UNIX_TIMESTAMP ) { switch ( $ type ) { case self :: UNIX_TIMESTAMP : $ seconds = $ this -> convertJdToUnix ( $ this -> day_count ) ; if ( $ seconds === false ) { return false ; } else { return $ seconds + $ this -> seconds ; } break ; case self :: EXIF_STRING : list ( $ year ... | Return the timestamp of the entry . |
34,742 | public function setValue ( $ timestamp , $ type = self :: UNIX_TIMESTAMP ) { switch ( $ type ) { case self :: UNIX_TIMESTAMP : $ this -> day_count = $ this -> convertUnixToJd ( $ timestamp ) ; $ this -> seconds = $ timestamp % 86400 ; break ; case self :: EXIF_STRING : $ d = preg_split ( '/[^0-9]+/' , $ timestamp ) ; f... | Update the timestamp held by this entry . |
34,743 | public static function shortToBytes ( $ value , $ endian ) { if ( $ endian == self :: LITTLE_ENDIAN ) { return chr ( $ value ) . chr ( $ value >> 8 ) ; } else { return chr ( $ value >> 8 ) . chr ( $ value ) ; } } | Convert an unsigned short into two bytes . |
34,744 | public static function longToBytes ( $ value , $ endian ) { $ hex = str_pad ( base_convert ( $ value , 10 , 16 ) , 8 , '0' , STR_PAD_LEFT ) ; if ( $ endian == self :: LITTLE_ENDIAN ) { return ( chr ( hexdec ( $ hex { 6 } . $ hex { 7 } ) ) . chr ( hexdec ( $ hex { 4 } . $ hex { 5 } ) ) . chr ( hexdec ( $ hex { 2 } . $ h... | Convert an unsigned long into four bytes . |
34,745 | public static function sLongToBytes ( $ value , $ endian ) { if ( $ endian == self :: LITTLE_ENDIAN ) { return ( chr ( $ value ) . chr ( $ value >> 8 ) . chr ( $ value >> 16 ) . chr ( $ value >> 24 ) ) ; } else { return ( chr ( $ value >> 24 ) . chr ( $ value >> 16 ) . chr ( $ value >> 8 ) . chr ( $ value ) ) ; } } | Convert a signed long into four bytes . |
34,746 | public static function bytesToSByte ( $ bytes , $ offset ) { $ n = self :: bytesToByte ( $ bytes , $ offset ) ; if ( $ n > 127 ) { return $ n - 256 ; } else { return $ n ; } } | Extract a signed byte from bytes . |
34,747 | public static function bytesToShort ( $ bytes , $ offset , $ endian ) { if ( $ endian == self :: LITTLE_ENDIAN ) { return ( ord ( $ bytes { $ offset + 1 } ) * 256 + ord ( $ bytes { $ offset } ) ) ; } else { return ( ord ( $ bytes { $ offset } ) * 256 + ord ( $ bytes { $ offset + 1 } ) ) ; } } | Extract an unsigned short from bytes . |
34,748 | public static function bytesToSShort ( $ bytes , $ offset , $ endian ) { $ n = self :: bytesToShort ( $ bytes , $ offset , $ endian ) ; if ( $ n > 32767 ) { return $ n - 65536 ; } else { return $ n ; } } | Extract a signed short from bytes . |
34,749 | public static function bytesToLong ( $ bytes , $ offset , $ endian ) { if ( $ endian == self :: LITTLE_ENDIAN ) { return ( ord ( $ bytes { $ offset + 3 } ) * 16777216 + ord ( $ bytes { $ offset + 2 } ) * 65536 + ord ( $ bytes { $ offset + 1 } ) * 256 + ord ( $ bytes { $ offset } ) ) ; } else { return ( ord ( $ bytes { ... | Extract an unsigned long from bytes . |
34,750 | public static function bytesToSLong ( $ bytes , $ offset , $ endian ) { $ n = self :: bytesToLong ( $ bytes , $ offset , $ endian ) ; if ( $ n > 2147483647 ) { return $ n - 4294967296 ; } else { return $ n ; } } | Extract a signed long from bytes . |
34,751 | public static function bytesToRational ( $ bytes , $ offset , $ endian ) { return [ self :: bytesToLong ( $ bytes , $ offset , $ endian ) , self :: bytesToLong ( $ bytes , $ offset + 4 , $ endian ) ] ; } | Extract an unsigned rational from bytes . |
34,752 | public static function bytesToSRational ( $ bytes , $ offset , $ endian ) { return [ self :: bytesToSLong ( $ bytes , $ offset , $ endian ) , self :: bytesToSLong ( $ bytes , $ offset + 4 , $ endian ) ] ; } | Extract a signed rational from bytes . |
34,753 | public static function bytesToDump ( $ bytes , $ max = 0 ) { $ s = strlen ( $ bytes ) ; if ( $ max > 0 ) { $ s = min ( $ max , $ s ) ; } $ line = 24 ; for ( $ i = 0 ; $ i < $ s ; $ i ++ ) { printf ( '%02X ' , ord ( $ bytes { $ i } ) ) ; if ( ( $ i + 1 ) % $ line == 0 ) { print ( "\n" ) ; } } print ( "\n" ) ; } | Format bytes for dumping . |
34,754 | public function setExif ( PelExif $ exif ) { $ app0_offset = 1 ; $ app1_offset = - 1 ; $ sections_count = count ( $ this -> sections ) ; for ( $ i = 0 ; $ i < $ sections_count ; $ i ++ ) { if ( ! empty ( $ this -> sections [ $ i ] [ 0 ] ) ) { $ section = $ this -> sections [ $ i ] ; if ( $ section [ 0 ] == PelJpegMarke... | Set Exif data . |
34,755 | public function setICC ( PelJpegContent $ icc ) { $ app1_offset = 1 ; $ app2_offset = - 1 ; $ count_sections = count ( $ this -> sections ) ; for ( $ i = 0 ; $ i < $ count_sections ; $ i ++ ) { if ( ! empty ( $ this -> sections [ $ i ] [ 0 ] ) ) { if ( $ this -> sections [ $ i ] [ 0 ] == PelJpegMarker :: APP1 ) { $ app... | Set ICC data . |
34,756 | public function getExif ( ) { $ sections_count = count ( $ this -> sections ) ; for ( $ i = 0 ; $ i < $ sections_count ; $ i ++ ) { $ section = $ this -> getSection ( PelJpegMarker :: APP1 , $ i ) ; if ( $ section instanceof PelExif ) { return $ section ; } } return null ; } | Get first valid APP1 Exif section data . |
34,757 | public function getICC ( ) { $ icc = $ this -> getSection ( PelJpegMarker :: APP2 ) ; if ( $ icc instanceof PelJpegContent ) { return $ icc ; } return null ; } | Get ICC data . |
34,758 | public function clearExif ( ) { $ idx = 0 ; while ( $ idx < count ( $ this -> sections ) ) { $ s = $ this -> sections [ $ idx ] ; if ( ( $ s [ 0 ] == PelJpegMarker :: APP1 ) && ( $ s [ 1 ] instanceof PelExif ) ) { array_splice ( $ this -> sections , $ idx , 1 ) ; $ idx -- ; } else { ++ $ idx ; } } } | Clear any Exif data . |
34,759 | public function insertSection ( $ marker , PelJpegContent $ content , $ offset ) { array_splice ( $ this -> sections , $ offset , 0 , [ [ $ marker , $ content ] ] ) ; } | Insert a new section . |
34,760 | public function getSection ( $ marker , $ skip = 0 ) { foreach ( $ this -> sections as $ s ) { if ( $ s [ 0 ] == $ marker ) { if ( $ skip > 0 ) { $ skip -- ; } else { return $ s [ 1 ] ; } } } return null ; } | Get a section corresponding to a particular marker . |
34,761 | public function getBytes ( ) { $ bytes = '' ; foreach ( $ this -> sections as $ section ) { $ m = $ section [ 0 ] ; $ c = $ section [ 1 ] ; $ bytes .= "\xFF" . PelJpegMarker :: getBytes ( $ m ) ; if ( $ m == PelJpegMarker :: SOI || $ m == PelJpegMarker :: EOI ) { continue ; } $ data = $ c -> getBytes ( ) ; $ size = str... | Turn this JPEG object into bytes . |
34,762 | public static function isValid ( PelDataWindow $ d ) { $ d -> setByteOrder ( PelConvert :: BIG_ENDIAN ) ; $ i = self :: getJpgSectionStart ( $ d ) ; return $ d -> getByte ( $ i ) == PelJpegMarker :: SOI ; } | Test data to see if it could be a valid JPEG image . |
34,763 | public static function getSize ( $ type ) { if ( array_key_exists ( $ type , self :: $ formatLength ) ) { return self :: $ formatLength [ $ type ] ; } else { return Pel :: fmt ( 'Unknown format: 0x%X' , $ type ) ; } } | Return the size of components in a given format in bytes needed to store one component with the given format . |
34,764 | public static function getTagByName ( $ name ) { $ k = array_search ( $ name , self :: $ exifTagsShort ) ; if ( $ k !== false ) { return $ k ; } $ k = array_search ( $ name , static :: $ gpsTagsShort ) ; if ( $ k !== false ) { return $ k ; } return array_search ( $ name , self :: $ canonTagsShort ) ; } | Reverse lookup of a tag id by its short name . Return false for the unknown tag name . |
34,765 | public static function getName ( $ type , $ tag ) { switch ( $ type ) { case PelIfd :: IFD0 : case PelIfd :: IFD1 : case PelIfd :: EXIF : case PelIfd :: INTEROPERABILITY : return self :: getValue ( self :: $ exifTagsShort , $ tag ) ; case PelIfd :: GPS : return self :: getValue ( self :: $ gpsTagsShort , $ tag ) ; case... | Returns a short name for an Exif tag . |
34,766 | public function getTitle ( $ type , $ tag ) { switch ( $ type ) { case PelIfd :: IFD0 : case PelIfd :: IFD1 : case PelIfd :: EXIF : case PelIfd :: INTEROPERABILITY : return Pel :: tra ( self :: getValue ( self :: $ exifTagsTitle , $ tag ) ) ; case PelIfd :: GPS : return Pel :: tra ( self :: getValue ( self :: $ gpsTags... | Returns a title for an Exif tag . |
34,767 | public function getText ( $ brief = false ) { switch ( $ this -> tag ) { case PelTag :: FILE_SOURCE : switch ( ord ( $ this -> bytes { 0 } ) ) { case 0x03 : return 'DSC' ; default : return sprintf ( '0x%02X' , ord ( $ this -> bytes { 0 } ) ) ; } break ; case PelTag :: SCENE_TYPE : switch ( ord ( $ this -> bytes { 0 } )... | Get the value of this entry as text . |
34,768 | public function load ( PelDataWindow $ d ) { Pel :: debug ( 'Parsing %d bytes of TIFF data...' , $ d -> getSize ( ) ) ; if ( $ d -> getSize ( ) < 8 ) { throw new PelInvalidDataException ( 'Expected at least 8 bytes of TIFF ' . 'data, found just %d bytes.' , $ d -> getSize ( ) ) ; } if ( $ d -> strcmp ( 0 , 'II' ) ) { P... | Load TIFF data . |
34,769 | public function setIfd ( PelIfd $ ifd ) { if ( $ ifd -> getType ( ) != PelIfd :: IFD0 ) { throw new PelInvalidDataException ( 'Invalid type of IFD: %d, expected %d.' , $ ifd -> getType ( ) , PelIfd :: IFD0 ) ; } $ this -> ifd = $ ifd ; } | Set the first IFD . |
34,770 | public function getBytes ( $ order = PelConvert :: LITTLE_ENDIAN ) { if ( $ order == PelConvert :: LITTLE_ENDIAN ) { $ bytes = 'II' ; } else { $ bytes = 'MM' ; } $ bytes .= PelConvert :: shortToBytes ( self :: TIFF_HEADER , $ order ) ; if ( $ this -> ifd !== null ) { $ bytes .= PelConvert :: longToBytes ( 8 , $ order )... | Turn this object into bytes . |
34,771 | public static function isValid ( PelDataWindow $ d ) { if ( $ d -> getSize ( ) < 8 ) { return false ; } if ( $ d -> strcmp ( 0 , 'II' ) ) { $ d -> setByteOrder ( PelConvert :: LITTLE_ENDIAN ) ; } elseif ( $ d -> strcmp ( 0 , 'MM' ) ) { Pel :: debug ( 'Found Motorola byte order' ) ; $ d -> setByteOrder ( PelConvert :: B... | Check if data is valid TIFF data . |
34,772 | public function setValue ( $ str , $ from_exif = false ) { $ zlen = strlen ( static :: ZEROES ) ; if ( false !== $ from_exif ) { $ s = $ str ; if ( substr ( $ str , - $ zlen , $ zlen ) == static :: ZEROES ) { $ str = substr ( $ str , 0 , - $ zlen ) ; } $ str = mb_convert_encoding ( $ str , 'UTF-8' , 'UCS-2LE' ) ; } els... | Give the entry a new value . |
34,773 | public function setValue ( $ photographer = '' , $ editor = '' ) { $ this -> photographer = $ photographer ; $ this -> editor = $ editor ; if ( $ photographer == '' && $ editor != '' ) { $ photographer = ' ' ; } if ( $ editor == '' ) { parent :: setValue ( $ photographer ) ; } else { parent :: setValue ( $ photographer... | Update the copyright information . |
34,774 | public function getText ( $ brief = false ) { if ( $ brief ) { $ p = '' ; $ e = '' ; } else { $ p = ' ' . Pel :: tra ( '(Photographer)' ) ; $ e = ' ' . Pel :: tra ( '(Editor)' ) ; } if ( $ this -> photographer != '' && $ this -> editor != '' ) { return $ this -> photographer . $ p . ' - ' . $ this -> editor . $ e ; } i... | Return a text string with the copyright information . |
34,775 | public static function getDescription ( $ marker ) { if ( array_key_exists ( $ marker , self :: $ jpegMarkerShort ) ) { if ( array_key_exists ( $ marker , self :: $ jpegMarkerDescriptions ) ) { return self :: $ jpegMarkerDescriptions [ $ marker ] ; } else { $ splitted = preg_split ( "/(\d+)/" , self :: $ jpegMarkerShor... | Returns a description of a JPEG marker . |
34,776 | public function setValueArray ( $ value ) { foreach ( $ value as $ v ) { $ this -> validateNumber ( $ v ) ; } $ this -> components = count ( $ value ) ; $ this -> value = $ value ; } | Change the value . |
34,777 | public function addNumber ( $ n ) { $ this -> validateNumber ( $ n ) ; $ this -> value [ ] = $ n ; $ this -> components ++ ; } | Add a number . |
34,778 | public function getBytes ( $ o ) { $ bytes = '' ; for ( $ i = 0 ; $ i < $ this -> components ; $ i ++ ) { if ( $ this -> dimension == 1 ) { $ bytes .= $ this -> numberToBytes ( $ this -> value [ $ i ] , $ o ) ; } else { for ( $ j = 0 ; $ j < $ this -> dimension ; $ j ++ ) { $ bytes .= $ this -> numberToBytes ( $ this -... | Turn this entry into bytes . |
34,779 | public function getText ( $ brief = false ) { if ( $ this -> components == 0 ) { return '' ; } $ str = $ this -> formatNumber ( $ this -> value [ 0 ] ) ; for ( $ i = 1 ; $ i < $ this -> components ; $ i ++ ) { $ str .= ( $ brief ? ' ' : ', ' ) ; $ str .= $ this -> formatNumber ( $ this -> value [ $ i ] ) ; } return $ s... | Get the numeric value of this entry as text . |
34,780 | public function setValue ( $ comment = '' , $ encoding = 'ASCII' ) { $ this -> comment = $ comment ; $ this -> encoding = $ encoding ; parent :: setValue ( str_pad ( $ encoding , 8 , chr ( 0 ) ) . $ comment ) ; } | Set the user comment . |
34,781 | public function setWindowStart ( $ start ) { if ( $ start < 0 || $ start > $ this -> size ) { throw new PelDataWindowWindowException ( 'Window [%d, %d] does ' . 'not fit in window [0, %d]' , $ start , $ this -> size , $ this -> size ) ; } $ this -> start += $ start ; $ this -> size -= $ start ; } | Move the start of the window forward . |
34,782 | public function setWindowSize ( $ size ) { if ( $ size < 0 ) { $ size += $ this -> size ; } if ( $ size < 0 || $ size > $ this -> size ) { throw new PelDataWindowWindowException ( 'Window [0, %d] ' . 'does not fit in window [0, %d]' , $ size , $ this -> size ) ; } $ this -> size = $ size ; } | Adjust the size of the window . The size can only be made smaller . |
34,783 | public function getClone ( $ start = null , $ size = null ) { $ c = clone $ this ; if ( is_int ( $ start ) ) { $ c -> setWindowStart ( $ start ) ; } if ( is_int ( $ size ) ) { $ c -> setWindowSize ( $ size ) ; } return $ c ; } | Make a new data window with the same data as the this window . |
34,784 | private function validateOffset ( $ offset ) { if ( $ offset < 0 || $ offset >= $ this -> size ) { throw new PelDataWindowOffsetException ( 'Offset %d not within [%d, %d]' , $ offset , 0 , $ this -> size - 1 ) ; } } | Validate an offset against the current window . |
34,785 | public function getBytes ( $ start = null , $ size = null ) { if ( is_int ( $ start ) ) { if ( $ start < 0 ) { $ start += $ this -> size ; } $ this -> validateOffset ( $ start ) ; } else { $ start = 0 ; } if ( is_int ( $ size ) ) { if ( $ size <= 0 ) { $ size += $ this -> size - $ start ; } $ this -> validateOffset ( $... | Return some or all bytes visible in the window . |
34,786 | public function getByte ( $ offset = 0 ) { $ this -> validateOffset ( $ offset ) ; $ offset += $ this -> start ; return PelConvert :: bytesToByte ( $ this -> data , $ offset ) ; } | Return an unsigned byte from the data . |
34,787 | public function getSByte ( $ offset = 0 ) { $ this -> validateOffset ( $ offset ) ; $ offset += $ this -> start ; return PelConvert :: bytesToSByte ( $ this -> data , $ offset ) ; } | Return a signed byte from the data . |
34,788 | public function getShort ( $ offset = 0 ) { $ this -> validateOffset ( $ offset ) ; $ this -> validateOffset ( $ offset + 1 ) ; $ offset += $ this -> start ; return PelConvert :: bytesToShort ( $ this -> data , $ offset , $ this -> order ) ; } | Return an unsigned short read from the data . |
34,789 | public function getSShort ( $ offset = 0 ) { $ this -> validateOffset ( $ offset ) ; $ this -> validateOffset ( $ offset + 1 ) ; $ offset += $ this -> start ; return PelConvert :: bytesToSShort ( $ this -> data , $ offset , $ this -> order ) ; } | Return a signed short read from the data . |
34,790 | public function getLong ( $ offset = 0 ) { $ this -> validateOffset ( $ offset ) ; $ this -> validateOffset ( $ offset + 3 ) ; $ offset += $ this -> start ; return PelConvert :: bytesToLong ( $ this -> data , $ offset , $ this -> order ) ; } | Return an unsigned long read from the data . |
34,791 | public function getSLong ( $ offset = 0 ) { $ this -> validateOffset ( $ offset ) ; $ this -> validateOffset ( $ offset + 3 ) ; $ offset += $ this -> start ; return PelConvert :: bytesToSLong ( $ this -> data , $ offset , $ this -> order ) ; } | Return a signed long read from the data . |
34,792 | public function strcmp ( $ offset , $ str ) { $ s = strlen ( $ str ) ; $ this -> validateOffset ( $ offset ) ; $ this -> validateOffset ( $ offset + $ s - 1 ) ; $ offset += $ this -> start ; for ( $ i = 0 ; $ i < $ s ; $ i ++ ) { if ( $ this -> data { $ offset + $ i } != $ str { $ i } ) { return false ; } } return true... | String comparison on substrings . |
34,793 | public function setValue ( $ str ) { $ this -> components = strlen ( $ str ) + 1 ; $ this -> str = $ str ; $ this -> bytes = $ str . chr ( 0x00 ) ; } | Give the entry a new ASCII value . |
34,794 | public static function maybeThrow ( PelException $ e ) { if ( self :: $ strict ) { throw $ e ; } else { self :: $ exceptions [ ] = $ e ; self :: warning ( '%s (%s:%s)' , $ e -> getMessage ( ) , basename ( $ e -> getFile ( ) ) , $ e -> getLine ( ) ) ; } } | Conditionally throw an exception . |
34,795 | public static function debug ( $ format ) { if ( self :: $ debug ) { $ args = func_get_args ( ) ; $ str = array_shift ( $ args ) ; vprintf ( $ str . "\n" , $ args ) ; } } | Conditionally output debug information . |
34,796 | public static function fmt ( $ format ) { $ args = func_get_args ( ) ; $ str = array_shift ( $ args ) ; return vsprintf ( self :: dgettextWrapper ( 'pel' , $ str ) , $ args ) ; } | Translate and format a string . |
34,797 | private static function dgettextWrapper ( $ domain , $ str ) { if ( self :: $ hasdgetext === null ) { self :: $ hasdgetext = function_exists ( 'dgettext' ) ; if ( self :: $ hasdgetext === true ) { bindtextdomain ( 'pel' , __DIR__ . '/locale' ) ; } } if ( self :: $ hasdgetext ) { return dgettext ( $ domain , $ str ) ; }... | Warapper for dgettext . The untranslated stub will be return in the case that dgettext is not available . |
34,798 | public function load ( PelDataWindow $ d ) { Pel :: debug ( 'Parsing %d bytes of Exif data...' , $ d -> getSize ( ) ) ; if ( $ d -> getSize ( ) < 6 ) { throw new PelInvalidDataException ( 'Expected at least 6 bytes of Exif ' . 'data, found just %d bytes.' , $ d -> getSize ( ) ) ; } if ( $ d -> strcmp ( 0 , self :: EXIF... | Load and parse Exif data . |
34,799 | private static function findFile ( $ file = null ) { if ( null !== $ file ) { $ rfile = realpath ( $ file ) ; if ( false === $ rfile ) { throw new \ Exception ( __CLASS__ . ": Database file '{$file}' does not seem to exist." , self :: EXCEPTION_DBFILE_NOT_FOUND ) ; } return $ rfile ; } else { $ current = realpath ( dir... | Return the realpath of the given file or look for the first matching database option |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.