idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
14,400
public function setAttachmentDefaults ( $ defaults ) { if ( $ this -> attachmentDefaults != ( $ defaults = ( array ) $ defaults ) ) { $ this -> attachmentDefaults = $ defaults ; $ this -> setAttachments ( $ this -> attachments ) ; } return $ this ; }
Set the attachments defaults .
14,401
protected function getAttachmentPayload ( $ text = null , $ title = null , $ images = null , $ color = null ) { $ attachment = [ ] ; if ( $ text ) { $ attachment [ 'text' ] = $ this -> stringValue ( $ text ) ; } if ( $ title ) { $ attachment [ 'title' ] = $ this -> stringValue ( $ title ) ; } if ( $ images = $ this -> getImagesPayload ( $ images ) ) { $ attachment [ 'images' ] = $ images ; } if ( $ color ) { $ attachment [ 'color' ] = ( string ) $ color ; } return $ attachment ; }
Get payload for an attachment .
14,402
protected function getImagesPayload ( $ value ) { $ images = [ ] ; foreach ( ( array ) $ value as $ img ) { if ( ! empty ( $ img [ 'url' ] ) ) { $ img = $ img [ 'url' ] ; } if ( is_string ( $ img ) && ! empty ( $ img ) ) { $ images [ ] = [ 'url' => $ img ] ; } } return $ images ; }
Get payload for images .
14,403
protected function stringValue ( $ value , $ jsonOptions = JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ) { if ( is_string ( $ value ) ) { return $ value ; } if ( method_exists ( $ value , '__toString' ) ) { return ( string ) $ value ; } if ( method_exists ( $ value , 'toArray' ) ) { $ value = $ value -> toArray ( ) ; } return json_encode ( $ value , $ jsonOptions ) ; }
Convert any type to string .
14,404
public function addImage ( $ image , $ desc = null , $ title = null ) { return $ this -> addAttachment ( $ desc , $ title , $ image ) ; }
Add an image attachment to the message .
14,405
public function configureDefaults ( array $ defaults , $ force = false ) { if ( $ force || empty ( $ this -> toArray ( ) ) ) { $ attachmentDefaults = $ this -> attachmentDefaults ; foreach ( MessageDefaults :: allKeys ( ) as $ key ) { if ( isset ( $ defaults [ $ key ] ) && ! is_null ( $ value = $ defaults [ $ key ] ) ) { if ( strpos ( $ key , 'attachment_' ) !== false ) { if ( $ key = substr ( $ key , strlen ( 'attachment_' ) ) ) { $ attachmentDefaults [ $ key ] = $ value ; } } else { $ this -> fillDefaults ( $ key , $ value ) ; } } } $ this -> setAttachmentDefaults ( $ attachmentDefaults ) ; } return $ this ; }
Configure message defaults .
14,406
protected function fillDefaults ( $ key , $ value ) { if ( ( $ key === MessageDefaults :: USER || $ key === MessageDefaults :: CHANNEL ) && ( ! is_null ( $ this -> getTarget ( ) ) ) ) { return ; } if ( $ suffix = $ this -> studlyCase ( $ key ) ) { $ getMethod = 'get' . $ suffix ; $ setMethod = 'set' . $ suffix ; if ( method_exists ( $ this , $ getMethod ) && is_null ( $ this -> { $ getMethod } ( ) ) && method_exists ( $ this , $ setMethod ) ) { $ this -> { $ setMethod } ( $ value ) ; } } }
Fill with message defaults .
14,407
public function content ( ) { $ arguments = func_get_args ( ) ; $ count = count ( $ arguments ) ; if ( $ count > 0 ) { $ this -> setText ( $ arguments [ 0 ] ) ; } if ( $ count > 1 ) { if ( is_bool ( $ arguments [ 1 ] ) ) { $ this -> setMarkdown ( $ arguments [ 1 ] ) ; if ( $ count > 2 ) { $ this -> setNotification ( $ arguments [ 2 ] ) ; } } else { call_user_func_array ( [ $ this , 'addAttachment' ] , array_slice ( $ arguments , 1 ) ) ; } } return $ this ; }
Conveniently set message content .
14,408
public function toArray ( ) { return array_filter ( [ 'text' => $ this -> getText ( ) , 'notification' => $ this -> getNotification ( ) , 'markdown' => $ this -> getMarkdown ( ) , 'channel' => $ this -> getChannel ( ) , 'user' => $ this -> getUser ( ) , 'attachments' => $ this -> getAttachments ( ) , ] , function ( $ value , $ key ) { return ! ( is_null ( $ value ) || ( $ key === 'markdown' && $ value === true ) || ( is_array ( $ value ) && empty ( $ value ) ) ) ; } , ARRAY_FILTER_USE_BOTH ) ; }
Convert the message to an array .
14,409
public function syncWithProductType ( ProductTypeContract $ productType , $ attributeIds , array $ requiredAttributes = [ ] ) { $ attributeIds = is_array ( $ attributeIds ) ? $ attributeIds : [ $ attributeIds ] ; $ pivot = [ ] ; foreach ( $ attributeIds as $ id ) { $ pivot [ $ id ] = [ 'required' => in_array ( $ id , $ requiredAttributes ) ] ; } return $ productType -> attributes ( ) -> sync ( $ pivot ) ; }
Relates attributes to a product type .
14,410
public function getData ( $ order = self :: SORT_DESC ) { return array ( 'items' => array_map ( function ( Item $ item ) { return $ item -> toArray ( ) ; } , array_values ( $ this -> getItems ( $ order ) ) ) , ) ; }
Get data in array format .
14,411
public function generate ( ) : string { $ config = '' ; foreach ( $ this -> getParams ( ) as $ key => $ value ) { $ config .= $ key . ( ( \ strlen ( $ value ) > 0 ) ? ' ' . $ value : '' ) . "\n" ; } $ certs = $ this -> getCerts ( ) ; if ( \ count ( $ certs ) > 0 ) { $ config .= "\n### Certificates\n" ; foreach ( $ this -> getCerts ( ) as $ key => $ value ) { $ config .= isset ( $ value [ 'content' ] ) ? "<$key>\n{$value['content']}\n</$key>\n" : "$key {$value['path']}\n" ; } } $ pushes = $ this -> getPushes ( ) ; if ( \ count ( $ pushes ) > 0 ) { $ config .= "\n### Networking\n" ; foreach ( $ this -> getPushes ( ) as $ push ) { $ config .= 'push "' . $ push . "\"\n" ; } } return $ config ; }
Generate config by parameters in memory
14,412
public function addCert ( string $ type , string $ pathOrContent , bool $ isContent = false ) : ConfigInterface { $ type = mb_strtolower ( $ type ) ; $ this -> throwIfNotInArray ( $ type , self :: CERTS ) ; if ( true === $ isContent ) { $ this -> _certs [ $ type ] [ 'content' ] = $ pathOrContent ; } else { $ this -> _certs [ $ type ] [ 'path' ] = $ pathOrContent ; } return $ this ; }
Add new cert into the configuration
14,413
public function delCert ( string $ type ) : ConfigInterface { $ type = mb_strtolower ( $ type ) ; $ this -> throwIfNotInArray ( $ type , self :: CERTS ) ; unset ( $ this -> _certs [ $ type ] ) ; return $ this ; }
Remove selected certificate from array
14,414
public function getCert ( string $ type ) : array { $ type = mb_strtolower ( $ type ) ; $ this -> throwIfNotInArray ( $ type , self :: CERTS ) ; return $ this -> _certs [ $ type ] ?? [ ] ; }
Return information about specified certificate
14,415
public function add ( string $ name , $ value = null ) : ConfigInterface { $ name = mb_strtolower ( $ name ) ; if ( \ in_array ( $ name , self :: CERTS , true ) ) { $ this -> addCert ( $ name , $ value ) ; } elseif ( $ name === 'push' ) { $ this -> addPush ( $ value ) ; } else { $ this -> _params [ $ name ] = $ this -> isBool ( $ value ) ; } return $ this ; }
Add some new parameter to the list of parameters
14,416
public function del ( string $ name ) : ConfigInterface { if ( \ in_array ( $ name , self :: CERTS , true ) ) { $ this -> delCert ( $ name ) ; } elseif ( $ name === 'push' ) { throw new \ RuntimeException ( "Not possible to remove push, use 'delPush' instead" ) ; } else { $ this -> _params = array_map ( function ( $ param ) use ( $ name ) { return ( $ param [ 'name' ] === $ name ) ? null : $ param ; } , $ this -> _params ) ; } return $ this ; }
Remove some parameter from array by name
14,417
public function getStats ( array $ options = array ( ) ) { $ resolver = new OptionsResolver ( ) ; $ resolver -> setDefaults ( array ( 'includeTextInShapes' => 'true' , ) ) -> setDefined ( array ( 'includeFootnotes' , 'includeComments' , ) ) ; $ options = $ resolver -> resolve ( $ options ) ; $ strURI = Product :: $ baseProductUri . '/words/' . $ this -> getFileName ( ) . '/statistics?' . http_build_query ( $ options ) ; AsposeApp :: getLogger ( ) -> info ( 'WordsDocument getStats call will be made' , array ( 'call-uri' => $ strURI , ) ) ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) { return $ json -> StatData ; } AsposeApp :: getLogger ( ) -> warning ( 'Error occured, http 200 code was not found.' , array ( 'json-code' => $ json -> Code , ) ) ; return false ; }
Get Document s stats . Add includeTextInShapes or includeFootnotes booleans to determine or these words should be added to the word count .
14,418
public function appendDocument ( $ appendDocs , $ importFormatModes , $ sourceFolder ) { if ( count ( $ appendDocs ) != count ( $ importFormatModes ) ) throw new Exception ( 'Please specify complete documents and import format modes' ) ; $ post_array = array ( ) ; $ i = 0 ; foreach ( $ appendDocs as $ doc ) { $ post_array [ ] = array ( "Href" => ( ( $ sourceFolder != "" ) ? $ sourceFolder . "\\" . $ doc : $ doc ) , "ImportFormatMode" => $ importFormatModes [ $ i ] ) ; $ i ++ ; } $ data = array ( "DocumentEntries" => $ post_array ) ; $ json = json_encode ( $ data ) ; $ strURI = Product :: $ baseProductUri . '/words/' . $ this -> getFileName ( ) . '/appendDocument' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'POST' , 'json' , $ json ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { $ folder = new Folder ( ) ; $ outputStream = $ folder -> GetFile ( $ sourceFolder . ( ( $ sourceFolder == '' ) ? '' : '/' ) . $ this -> getFileName ( ) ) ; $ outputPath = AsposeApp :: $ outPutLocation . $ this -> getFileName ( ) ; Utils :: saveFile ( $ outputStream , $ outputPath ) ; return $ outputPath ; } AsposeApp :: getLogger ( ) -> warning ( 'Error occured, output could not be validated.' , array ( 'v-output' => $ v_output , ) ) ; return $ v_output ; }
Appends a list of documents to this one .
14,419
public function unprotectDocument ( array $ options ) { $ resolver = new OptionsResolver ( ) ; $ resolver -> setRequired ( 'Password' ) -> setDefaults ( array ( 'ProtectionType' => 'AllowOnlyComments' ) ) -> setAllowedValues ( 'ProtectionType' , array ( 'AllowOnlyComments' , 'AllowOnlyFormFields' , 'AllowOnlyRevisions' , 'ReadOnly' , 'NoProtection' , ) ) ; $ options = $ resolver -> resolve ( $ options ) ; $ json = json_encode ( $ options ) ; $ strURI = Product :: $ baseProductUri . '/words/' . $ this -> getFileName ( ) . '/protection' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'DELETE' , 'json' , $ json ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { $ strURI = Product :: $ baseProductUri . '/storage/file/' . $ this -> getFileName ( ) ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ outputFile = AsposeApp :: $ outPutLocation . $ this -> getFileName ( ) ; Utils :: saveFile ( $ responseStream , $ outputFile ) ; return $ outputFile ; } else { return $ v_output ; } }
Unprotect a document on the Aspose cloud storage .
14,420
public function updateProtection ( $ oldPassword , $ newPassword , $ protectionType = 'AllowOnlyComments' ) { if ( $ oldPassword == '' ) { throw new Exception ( 'Please Specify Old Password' ) ; } if ( $ newPassword == '' ) { throw new Exception ( 'Please Specify New Password' ) ; } $ fieldsArray = array ( 'Password' => $ oldPassword , 'NewPassword' => $ newPassword , 'ProtectionType' => $ protectionType ) ; $ json = json_encode ( $ fieldsArray ) ; $ strURI = Product :: $ baseProductUri . '/words/' . $ this -> getFileName ( ) . '/protection' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'POST' , 'json' , $ json ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { $ strURI = Product :: $ baseProductUri . '/storage/file/' . $ this -> getFileName ( ) ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ outputFile = AsposeApp :: $ outPutLocation . $ this -> getFileName ( ) ; Utils :: saveFile ( $ responseStream , $ outputFile ) ; return $ outputFile ; } else return $ v_output ; }
Update document protection .
14,421
public function getPageSetup ( $ sectionid = '' ) { if ( $ sectionid == '' ) throw new Exception ( 'No Section Id specified' ) ; $ strURI = Product :: $ baseProductUri . '/words/' . $ this -> getFileName ( ) . '/sections/' . $ sectionid . '/pageSetup' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) { return $ json -> PageSetup ; } AsposeApp :: getLogger ( ) -> warning ( 'Error occured, http 200 code was not found.' , array ( 'json-code' => $ json -> Code , ) ) ; return false ; }
get page setup information from any section of a Word document .
14,422
public function getAllParagraphs ( ) { $ strURI = Product :: $ baseProductUri . '/words/' . $ this -> getFileName ( ) . '/paragraphs' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) { return $ json -> Paragraphs -> ParagraphLinkList ; } AsposeApp :: getLogger ( ) -> warning ( 'Error occured, http 200 code was not found.' , array ( 'json-code' => $ json -> Code , ) ) ; return false ; }
get a list of all paragraphs present in a Word document .
14,423
public function getParagraph ( $ paragraphid = '' ) { if ( $ paragraphid == '' ) throw new Exception ( 'No Paragraph Id specified' ) ; $ strURI = Product :: $ baseProductUri . '/words/' . $ this -> getFileName ( ) . '/paragraphs/' . $ paragraphid . '' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) { return $ json -> Paragraph ; } AsposeApp :: getLogger ( ) -> warning ( 'Error occured, http 200 code was not found.' , array ( 'json-code' => $ json -> Code , ) ) ; return false ; }
get specefic paragraphs present in a Word document .
14,424
public function updateParagraphRunFont ( $ options_xml = '' , $ paragraphid = '' , $ runid = '' ) { if ( $ options_xml == '' ) throw new Exception ( 'Options not specified.' ) ; if ( $ paragraphid == '' ) throw new Exception ( 'No Paragraph Id specified' ) ; if ( $ runid == '' ) throw new Exception ( 'No Run Id specified' ) ; $ strURI = Product :: $ baseProductUri . '/words/' . $ this -> getFileName ( ) . '/paragraphs/' . $ paragraphid . '/runs/' . $ runid . '/font' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'POST' , 'XML' , $ options_xml , 'json' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) { return $ json -> Font ; } AsposeApp :: getLogger ( ) -> warning ( 'Error occured, http 200 code was not found.' , array ( 'json-code' => $ json -> Code , ) ) ; return false ; }
update font information from any run of a paragraph .
14,425
public function getHyperlinks ( ) { $ strURI = Product :: $ baseProductUri . '/words/' . $ this -> getFileName ( ) . '/hyperlinks' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) { return $ json -> Hyperlinks -> HyperlinkList ; } AsposeApp :: getLogger ( ) -> warning ( 'Error occured, http 200 code was not found.' , array ( 'json-code' => $ json -> Code , ) ) ; return false ; }
Get all Hyperlinks from a Word
14,426
public function getHyperlink ( $ hyperlinkIndex ) { if ( $ hyperlinkIndex == '' ) throw new Exception ( 'Hyperlink index not specified' ) ; $ strURI = Product :: $ baseProductUri . '/words/' . $ this -> getFileName ( ) . '/hyperlinks/' . $ hyperlinkIndex ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) { return $ json -> Hyperlink ; } AsposeApp :: getLogger ( ) -> warning ( 'Error occured, http 200 code was not found.' , array ( 'json-code' => $ json -> Code , ) ) ; return false ; }
Get a Particular Hyperlink from a Word
14,427
public function getBookmarks ( ) { $ strURI = Product :: $ baseProductUri . '/words/' . $ this -> getFileName ( ) . '/bookmarks' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) { return $ json -> Bookmarks -> BookmarkList ; } AsposeApp :: getLogger ( ) -> warning ( 'Error occured, http 200 code was not found.' , array ( 'json-code' => $ json -> Code , ) ) ; return false ; }
Get all Bookmarks from a Word
14,428
public function getBookmark ( $ bookmarkName ) { if ( $ bookmarkName == '' ) throw new Exception ( 'Bookmark name not specified' ) ; $ strURI = Product :: $ baseProductUri . '/words/' . $ this -> getFileName ( ) . '/bookmarks/' . $ bookmarkName ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) { return $ json -> Bookmark ; } AsposeApp :: getLogger ( ) -> warning ( 'Error occured, http 200 code was not found.' , array ( 'json-code' => $ json -> Code , ) ) ; return false ; }
Get a Specific Bookmark from a Word
14,429
public function updateBookmark ( $ bookmarkName , $ bookmarkText ) { if ( $ bookmarkName == '' ) throw new Exception ( 'Bookmark name not specified' ) ; if ( $ bookmarkText == '' ) throw new Exception ( 'Bookmark text not specified' ) ; $ strURI = Product :: $ baseProductUri . '/words/' . $ this -> getFileName ( ) . '/bookmarks/' . $ bookmarkName ; $ signedURI = Utils :: sign ( $ strURI ) ; $ post_data_arr [ 'Text' ] = $ bookmarkText ; $ postData = json_encode ( $ post_data_arr ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'POST' , 'JSON' , $ postData ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) { return true ; } AsposeApp :: getLogger ( ) -> warning ( 'Error occured, http 200 code was not found.' , array ( 'json-code' => $ json -> Code , ) ) ; return false ; }
Update Bookmark Text of a Word
14,430
public function getComments ( $ slideNo = '' , $ storageName = '' , $ folder = '' ) { if ( $ slideNo == '' ) throw new Exception ( 'Missing required parameter slideNo' ) ; $ strURI = Product :: $ baseProductUri . '/slides/' . $ this -> getFileName ( ) . '/slides/' . $ slideNo . '/comments' ; if ( $ folder != '' ) { $ strURI .= '?folder=' . $ folder ; } if ( $ storageName != '' ) { $ strURI .= '&storage=' . $ storageName ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Status == 'OK' ) return $ json -> SlideComments ; else return false ; }
Get comments from a slide .
14,431
public function getImageCount ( $ storageName = '' , $ folder = '' ) { $ strURI = Product :: $ baseProductUri . '/slides/' . $ this -> getFileName ( ) . '/images' ; if ( $ folder != '' ) { $ strURI .= '?folder=' . $ folder ; } if ( $ storageName != '' ) { $ strURI .= '&storage=' . $ storageName ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; return count ( $ json -> Images -> List ) ; }
Gets total number of images in a presentation .
14,432
public function getShapes ( $ slidenumber , $ storageName = '' , $ folder = '' ) { $ strURI = Product :: $ baseProductUri . '/slides/' . $ this -> getFileName ( ) . '/slides/' . $ slidenumber . '/shapes' ; if ( $ folder != '' ) { $ strURI .= '?folder=' . $ folder ; } if ( $ storageName != '' ) { $ strURI .= '&storage=' . $ storageName ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; $ shapes = array ( ) ; foreach ( $ json -> ShapeList -> ShapesLinks as $ shape ) { $ signedURI = Utils :: sign ( $ shape -> Uri -> Href ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; $ shapes [ ] = $ json ; } return $ shapes ; }
Gets all shapes from the specified slide .
14,433
public function getShape ( $ slideNumber , $ shapeIndex , $ storageName = '' , $ folderName = '' ) { $ strURI = Product :: $ baseProductUri . '/slides/' . $ this -> getFileName ( ) . '/slides/' . $ slideNumber . '/shapes/' . $ shapeIndex ; if ( $ folderName != '' ) { $ strURI .= '?folder=' . $ folderName ; } if ( $ storageName != '' ) { $ strURI .= '&storage=' . $ storageName ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) return $ json -> Shape ; else return false ; }
Get a Particular Shape from the Slide .
14,434
public function getColorScheme ( $ slideNumber , $ storageName = '' ) { $ strURI = Product :: $ baseProductUri . '/slides/' . $ this -> getFileName ( ) . '/slides/' . $ slideNumber . '/theme/colorScheme' ; if ( $ storageName != '' ) { $ strURI .= '?storage=' . $ storageName ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; return $ json -> ColorScheme ; }
Get color scheme from the specified slide .
14,435
public function getFontScheme ( $ slideNumber , $ storageName = '' ) { $ strURI = Product :: $ baseProductUri . '/slides/' . $ this -> getFileName ( ) . '/slides/' . $ slideNumber . '/theme/fontScheme' ; if ( $ storageName != '' ) { $ strURI .= '?storage=' . $ storageName ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; return $ json -> FontScheme ; }
Get font scheme from the specified slide .
14,436
public function getFormatScheme ( $ slideNumber , $ storageName = '' ) { $ strURI = Product :: $ baseProductUri . '/slides/' . $ this -> getFileName ( ) . '/slides/' . $ slideNumber . '/theme/formatScheme' ; if ( $ storageName != '' ) { $ strURI .= '?storage=' . $ storageName ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; return $ json -> FormatScheme ; }
Get format scheme from the specified slide .
14,437
public function getPlaceholderCount ( $ slideNumber , $ storageName = '' , $ folder = '' ) { $ strURI = Product :: $ baseProductUri . '/slides/' . $ this -> getFileName ( ) . '/slides/' . $ slideNumber . '/placeholders' ; if ( $ folder != '' ) { $ strURI .= '?folder=' . $ folder ; } if ( $ storageName != '' ) { $ strURI .= '&storage=' . $ storageName ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; return count ( $ json -> Placeholders -> PlaceholderLinks ) ; }
Gets placeholder count from a particular slide .
14,438
public function getPlaceholder ( $ slideNumber , $ placeholderIndex , $ storageName = '' , $ folder = '' ) { $ strURI = Product :: $ baseProductUri . '/slides/' . $ this -> getFileName ( ) . '/slides/' . $ slideNumber . '/placeholders/' . $ placeholderIndex ; if ( $ folder != '' ) { $ strURI .= '?folder=' . $ folder ; } if ( $ storageName != '' ) { $ strURI .= '&storage=' . $ storageName ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; return $ json -> Placeholder ; }
Gets a placeholder from a particular slide .
14,439
public function getAssignments ( ) { $ strURI = Product :: $ baseProductUri . '/tasks/' . $ this -> getFileName ( ) . '/assignments/' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) return $ json -> Assignments -> AssignmentItem ; else return false ; }
Get project assignment items . Each assignment item has a link to get full assignment representation in the project .
14,440
public function getAssignment ( $ assignmentId ) { if ( $ assignmentId == '' ) throw new Exception ( 'Assignment ID not specified' ) ; $ strURI = Product :: $ baseProductUri . '/tasks/' . $ this -> getFileName ( ) . '/assignments/' . $ assignmentId ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) return $ json -> Assignment ; else return false ; }
Get project assignment .
14,441
public function addAssignment ( $ taskUid , $ resourceUid , $ units , $ changedFileName = '' ) { if ( $ taskUid == '' ) throw new Exception ( 'Task Uid not specified' ) ; if ( $ resourceUid == '' ) throw new Exception ( 'Resource Uid not specified' ) ; $ strURI = Product :: $ baseProductUri . '/tasks/' . $ this -> getFileName ( ) . '/assignments?taskUid=' . $ taskUid . '&resourceUid=' . $ resourceUid . '&units' . $ units ; if ( $ changedFileName != '' ) { $ strURI .= '&fileName=' . $ changedFileName ; $ this -> setFileName ( $ changedFileName ) ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'POST' , '' , '' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { $ folder = new Folder ( ) ; $ outputStream = $ folder -> GetFile ( $ this -> getFileName ( ) ) ; $ outputPath = AsposeApp :: $ outPutLocation . $ this -> getFileName ( ) ; Utils :: saveFile ( $ outputStream , $ outputPath ) ; return $ outputPath ; } else return $ v_output ; }
Adds a new assignment to a project .
14,442
public function getTasks ( ) { $ strURI = Product :: $ baseProductUri . '/tasks/' . $ this -> getFileName ( ) . '/tasks' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) return $ json -> Tasks -> TaskItem ; else return false ; }
Get project task items . Each task item has a link to get full task representation in the project .
14,443
public function getTask ( $ taskId ) { if ( $ taskId == '' ) throw new Exception ( 'Task ID not specified' ) ; $ strURI = Product :: $ baseProductUri . '/tasks/' . $ this -> getFileName ( ) . '/tasks/' . $ taskId ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) return $ json -> Task ; else return false ; }
Get task information .
14,444
public function addLink ( $ link , $ index , $ predecessorUid , $ successorUid , $ linkType , $ lag , $ lagFormat ) { if ( $ link == '' ) throw new Exception ( 'Link not specified' ) ; if ( $ index == '' ) throw new Exception ( 'Index not specified' ) ; if ( $ predecessorUid == '' ) throw new Exception ( 'Predecessor UID not specified' ) ; if ( $ successorUid == '' ) throw new Exception ( 'Successor UID not specified' ) ; if ( $ linkType == '' ) throw new Exception ( 'Link Type not specified' ) ; if ( ! isset ( $ lag ) ) throw new Exception ( 'Lag not specified' ) ; if ( $ lagFormat == '' ) throw new Exception ( 'Lag Format not specified' ) ; $ strURI = Product :: $ baseProductUri . '/tasks/' . $ this -> getFileName ( ) . '/taskLinks' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ data = array ( 'Link' => $ link , 'Index' => $ index , 'PredecessorUid' => $ predecessorUid , 'SuccessorUid' => $ successorUid , 'LinkType' => $ linkType , 'Lag' => $ lag , 'LagFormat' => $ lagFormat ) ; $ jsonData = json_encode ( $ data ) ; $ response = Utils :: processCommand ( $ signedURI , 'POST' , 'json' , $ jsonData ) ; $ json = json_decode ( $ response ) ; if ( $ json -> Code == 200 ) return true ; else return false ; }
Add a Task Link to Project
14,445
public function getOutlineCode ( $ outlineCodeId ) { if ( $ outlineCodeId == '' ) throw new Exception ( 'Outline Code ID not specified' ) ; $ strURI = Product :: $ baseProductUri . '/tasks/' . $ this -> getFileName ( ) . '/outlineCodes/' . $ outlineCodeId ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) return $ json -> OutlineCode ; else return false ; }
Get Outline Code
14,446
public function getExtendedAttribute ( $ extendedAttributeId ) { if ( $ extendedAttributeId == '' ) throw new Exception ( 'Extended Attribute ID not specified' ) ; $ strURI = Product :: $ baseProductUri . '/tasks/' . $ this -> getFileName ( ) . '/extendedAttributes/' . $ extendedAttributeId ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) return $ json -> ExtendedAttribute ; else return false ; }
Get project extended attribute definition .
14,447
public function deleteExtendedAttribute ( $ extendedAttributeId , $ changedFileName ) { if ( $ extendedAttributeId == '' ) throw new Exception ( 'Extended Attribute ID not specified' ) ; $ strURI = Product :: $ baseProductUri . '/tasks/' . $ this -> getFileName ( ) . '/extendedAttributes/' . $ extendedAttributeId ; if ( $ changedFileName != '' ) { $ strURI .= '?fileName=' . $ changedFileName ; $ this -> setFileName ( $ changedFileName ) ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'DELETE' , '' , '' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { $ folder = new Folder ( ) ; $ outputStream = $ folder -> GetFile ( $ this -> getFileName ( ) ) ; $ outputPath = AsposeApp :: $ outPutLocation . $ this -> getFileName ( ) ; Utils :: saveFile ( $ outputStream , $ outputPath ) ; return $ outputPath ; } else return $ v_output ; }
Delete a project extended attribute .
14,448
public static function compareTag ( ? string $ a , ? string $ b ) : int { if ( null === $ a ) { return null === $ b ? 0 : - 1 ; } return null === $ b ? 1 : strcmp ( $ a , $ b ) ; }
Compares two tags
14,449
public function updateBMPPropertiesFromLocalFile ( $ inputPath , $ bitsPerPixel , $ horizontalResolution , $ verticalResolution , $ outPath ) { if ( $ inputPath == '' ) throw new Exception ( 'Input file not specified' ) ; if ( $ bitsPerPixel == '' ) throw new Exception ( 'Color Depth not specified' ) ; if ( $ horizontalResolution == '' ) throw new Exception ( 'Horizontal Resolution not specified' ) ; if ( $ verticalResolution == '' ) throw new Exception ( 'Vertical Resolution not specified' ) ; if ( $ outPath == '' ) throw new Exception ( 'Output file name not specified' ) ; $ strURI = Product :: $ baseProductUri . '/imaging/bmp?bitsPerPixel=' . $ bitsPerPixel . '&horizontalResolution=' . $ horizontalResolution . '&verticalResolution=' . $ verticalResolution ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: uploadFileBinary ( $ signedURI , $ inputPath , 'xml' , 'POST' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { Utils :: saveFile ( $ responseStream , AsposeApp :: $ outPutLocation . $ outPath ) ; return $ outPath ; } else { return $ v_output ; } }
Update BMP Image Properties Without Storage .
14,450
public function updateGIFProperties ( $ backgroundColorIndex , $ pixelAspectRatio , $ interlaced , $ outPath ) { if ( $ backgroundColorIndex == '' ) throw new Exception ( 'Background color index not specified' ) ; if ( $ pixelAspectRatio == '' ) throw new Exception ( 'Pixel aspect ratio not specified' ) ; if ( $ outPath == '' ) throw new Exception ( 'Output file name not specified' ) ; $ strURI = Product :: $ baseProductUri . '/imaging/' . $ this -> getFileName ( ) . '/gif?backgroundColorIndex=' . $ backgroundColorIndex . '&pixelAspectRatio=' . $ pixelAspectRatio . '&interlaced=' . $ interlaced . '&outPath=' . $ outPath ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { $ folder = new Folder ( ) ; $ outputStream = $ folder -> GetFile ( $ outPath ) ; $ outputPath = AsposeApp :: $ outPutLocation . $ outPath ; Utils :: saveFile ( $ outputStream , $ outputPath ) ; return $ outputPath ; } else return $ v_output ; }
Update GIF Image Properties on Aspose cloud storage .
14,451
public function updateGIFPropertiesFromLocalFile ( $ inputPath , $ backgroundColorIndex , $ pixelAspectRatio , $ interlaced , $ outPath ) { if ( $ inputPath == '' ) throw new Exception ( 'Input file not specified' ) ; if ( $ backgroundColorIndex == '' ) throw new Exception ( 'Background color index not specified' ) ; if ( $ pixelAspectRatio == '' ) throw new Exception ( 'Pixel aspect ratio not specified' ) ; if ( $ outPath == '' ) throw new Exception ( 'Output file name not specified' ) ; $ strURI = Product :: $ baseProductUri . '/imaging/gif?backgroundColorIndex=' . $ backgroundColorIndex . '&pixelAspectRatio=' . $ pixelAspectRatio ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: uploadFileBinary ( $ signedURI , $ inputPath , 'xml' , 'POST' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { Utils :: saveFile ( $ responseStream , AsposeApp :: $ outPutLocation . $ outPath ) ; return $ outPath ; } else { return $ v_output ; } }
Update GIF Image Properties without storage .
14,452
public function updateJPGPropertiesFromLocalFile ( $ inputPath , $ quality , $ compressionType , $ outPath ) { if ( $ inputPath == '' ) throw new Exception ( 'Input file not specified' ) ; if ( $ quality == '' ) throw new Exception ( 'Quality not specified' ) ; if ( $ compressionType == '' ) throw new Exception ( 'Compression Type not specified' ) ; if ( $ outPath == '' ) throw new Exception ( 'Output file name not specified' ) ; $ strURI = Product :: $ baseProductUri . '/imaging/jpg?quality=' . $ quality . '&compressionType=' . $ compressionType . '&outPath=' . $ outPath ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: uploadFileBinary ( $ signedURI , $ inputPath , 'xml' , 'POST' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { Utils :: saveFile ( $ responseStream , AsposeApp :: $ outPutLocation . $ outPath ) ; return $ outPath ; } else { return $ v_output ; } }
Update JPG Image Properties on Aspose cloud storage .
14,453
public function updateTIFFPropertiesFromLocalFile ( $ inputPath , $ compression , $ resolutionUnit , $ newWidth , $ newHeight , $ horizontalResolution , $ verticalResolution , $ outPath ) { if ( $ inputPath == '' ) throw new Exception ( 'Input file not specified' ) ; if ( $ compression == '' ) throw new Exception ( 'Compression not specified' ) ; if ( $ resolutionUnit == '' ) throw new Exception ( 'Resolution unit not specified' ) ; if ( $ newWidth == '' ) throw new Exception ( 'New image width not specified' ) ; if ( $ newHeight == '' ) throw new Exception ( 'New image height not specified' ) ; if ( $ horizontalResolution == '' ) throw new Exception ( 'Horizontal resolution not specified' ) ; if ( $ verticalResolution == '' ) throw new Exception ( 'Vertical resolution not specified' ) ; if ( $ outPath == '' ) throw new Exception ( 'Output file name not specified' ) ; $ strURI = Product :: $ baseProductUri . '/imaging/tiff?compression=' . $ compression . '&resolutionUnit=' . $ resolutionUnit . '&newWidth=' . $ newWidth . '&newHeight=' . $ newHeight . '&horizontalResolution=' . $ horizontalResolution . '&verticalResolution=' . $ verticalResolution . '&outPath=' . $ outPath ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: uploadFileBinary ( $ signedURI , $ inputPath , 'xml' , 'POST' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { $ folder = new Folder ( ) ; $ outputStream = $ folder -> GetFile ( $ outPath ) ; $ outputPath = AsposeApp :: $ outPutLocation . $ outPath ; Utils :: saveFile ( $ outputStream , $ outputPath ) ; return $ outputPath ; } else return $ v_output ; }
Update TIFF Image Properties Without Storage .
14,454
public function updatePSDPropertiesFromLocalFile ( $ inputPath , $ channelsCount , $ compression , $ outPath ) { if ( $ channelsCount == '' ) throw new Exception ( 'Channels count not specified' ) ; if ( $ compression == '' ) throw new Exception ( 'Compression method not specified' ) ; if ( $ outPath == '' ) throw new Exception ( 'Output file name not specified' ) ; $ strURI = Product :: $ baseProductUri . '/imaging/psd?channelsCount=' . $ channelsCount . '&compression=' . $ compression . '&outPath=' . $ outPath ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: uploadFileBinary ( $ signedURI , $ inputPath , 'xml' , 'POST' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { $ folder = new Folder ( ) ; $ outputStream = $ folder -> GetFile ( $ outPath ) ; $ outputPath = AsposeApp :: $ outPutLocation . $ outPath ; Utils :: saveFile ( $ outputStream , $ outputPath ) ; return $ outputPath ; } else return $ v_output ; }
Update PSD Image Properties without storage .
14,455
public function checkRouteAccess ( string $ routeName , $ user = null ) : bool { return $ this -> laRoute -> checkRouteAccess ( $ routeName , $ user ) ; }
Twig extension callback for checking route access
14,456
public function checkModelAccess ( $ model , string $ action , $ user = null ) : bool { return $ this -> laModel -> checkModelAccess ( $ model , $ action , $ user ) ; }
Twig extension callback for checking model access
14,457
public function checkFieldAccess ( $ model , string $ fieldName , string $ action , $ user = null ) : bool { return $ this -> laModel -> checkFieldAccess ( $ model , $ fieldName , $ action , $ user ) ; }
Twig extension callback for checking field access
14,458
public function getRulesFor ( Symbol $ subject ) : array { $ rules = [ ] ; if ( ! $ subject -> isTerminal ( ) ) { foreach ( $ this -> rules as $ rule ) { if ( 0 === Symbol :: compare ( $ rule -> getSubject ( ) , $ subject ) ) { $ rules [ ] = $ rule ; } } } return $ rules ; }
Get rules defining a subject Symbol
14,459
public function getAttachment ( $ attachmentName ) { if ( $ attachmentName == '' ) throw new Exception ( 'Attachment Name not specified' ) ; $ strURI = Product :: $ baseProductUri . '/email/' . $ this -> getFileName ( ) . '/attachments/' . $ attachmentName ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { $ outputFilename = $ attachmentName ; Utils :: saveFile ( $ responseStream , AsposeApp :: $ outPutLocation . $ outputFilename ) ; return $ outputFilename ; } else { return $ v_output ; } }
Get email attachment .
14,460
public function addItem ( $ item ) { if ( ! is_numeric ( $ item ) ) { throw new \ InvalidArgumentException ( sprintf ( "Value '%s' must be a numeric value" , $ item ) ) ; } $ this -> items [ ] = $ item ; return $ this ; }
Add an item to the item list .
14,461
public function setColour ( $ colour ) { if ( ! preg_match ( '/^[a-f0-9]{6}$/i' , $ colour ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Value %s must be a valid hex colour' , $ colour ) ) ; } $ this -> colour = $ colour ; return $ this ; }
Set the colour of the line in the widget .
14,462
public function getColour ( ) { if ( null === $ this -> colour ) { $ this -> colour = self :: DEFAULT_COLOUR ; } return $ this -> colour ; }
Return the colour of the line in the widget .
14,463
public function setAxis ( $ dimension , $ labels ) { foreach ( $ labels as $ label ) { $ this -> addLabel ( $ dimension , $ label ) ; } return $ this ; }
Set the elements to appear evenly spread along dimension .
14,464
protected function addLabel ( $ dimension , $ label ) { if ( ! in_array ( $ dimension , array ( self :: DIMENSION_X , self :: DIMENSION_Y ) ) ) { throw new \ InvalidArgumentException ( sprintf ( "Value '%s' is not a valid dimension" , $ dimension ) ) ; } $ this -> axis [ $ dimension ] [ ] = $ label ; }
Add a new label to an specific axis .
14,465
public function getAxis ( ) { if ( null === $ this -> axis ) { $ this -> axis [ self :: DIMENSION_X ] = array ( ) ; $ this -> axis [ self :: DIMENSION_Y ] = array ( ) ; } return $ this -> axis ; }
Return axises in a 2D array .
14,466
public function removeWatermark ( $ fileName ) { if ( $ fileName == '' ) throw new Exception ( 'File not specified' ) ; $ strURI = Product :: $ baseProductUri . '/words/' . $ fileName . '/watermark' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'DELETE' , '' , '' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { $ folder = new Folder ( ) ; $ outputStream = $ folder -> GetFile ( $ fileName ) ; $ outputPath = AsposeApp :: $ outPutLocation . $ fileName ; Utils :: saveFile ( $ outputStream , $ outputPath ) ; return $ outputPath ; } else return $ v_output ; }
Remove watermark from document .
14,467
public function insertWatermarkText ( $ fileName , $ text , $ rotationAngle ) { if ( $ fileName == '' ) throw new Exception ( 'File not specified' ) ; $ fieldsArray = array ( 'Text' => $ text , 'RotationAngle' => $ rotationAngle ) ; $ json = json_encode ( $ fieldsArray ) ; $ strURI = Product :: $ baseProductUri . '/words/' . $ fileName . '/watermark/insertText' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'POST' , 'json' , $ json ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { $ folder = new Folder ( ) ; $ outputStream = $ folder -> GetFile ( $ fileName ) ; $ outputPath = AsposeApp :: $ outPutLocation . $ fileName ; Utils :: saveFile ( $ outputStream , $ outputPath ) ; return $ outputPath ; } else return $ v_output ; }
Inserts water mark text into the document .
14,468
public function replaceText ( $ fileName , $ oldValue , $ newValue , $ isMatchCase , $ isMatchWholeWord ) { if ( $ fileName == '' ) throw new Exception ( 'File not specified' ) ; $ fieldsArray = array ( 'OldValue' => $ oldValue , 'NewValue' => $ newValue , 'IsMatchCase' => $ isMatchCase , 'IsMatchWholeWord' => $ isMatchWholeWord ) ; $ json = json_encode ( $ fieldsArray ) ; $ strURI = Product :: $ baseProductUri . '/words/' . $ fileName . '/replaceText' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'POST' , 'json' , $ json ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { $ folder = new Folder ( ) ; $ outputStream = $ folder -> GetFile ( $ fileName ) ; $ outputPath = AsposeApp :: $ outPutLocation . $ fileName ; Utils :: saveFile ( $ outputStream , $ outputPath ) ; return $ outputPath ; } else return $ v_output ; }
Replace a text with the new value in the document .
14,469
public function handle ( AttributeValueRepository $ attributeValueRepository , Dispatcher $ event ) { $ attributeValue = $ attributeValueRepository -> find ( $ this -> id ) ; $ attributeValueRepository -> destroy ( $ attributeValue ) ; $ event -> fire ( new AttributeValueWasDestroyed ( $ attributeValue ) ) ; return $ attributeValue ; }
Handles destruction of the attribute value .
14,470
static function cleanUp ( $ string ) { if ( NORMALIZE_INTL ) { $ string = self :: replaceForNativeNormalize ( $ string ) ; $ norm = normalizer_normalize ( $ string , Normalizer :: FORM_C ) ; if ( $ norm === null || $ norm === false ) { if ( self :: quickIsNFCVerify ( $ string ) ) { return $ string ; } else { return normalizer_normalize ( $ string , Normalizer :: FORM_C ) ; } } else { return $ norm ; } } elseif ( self :: quickIsNFCVerify ( $ string ) ) { return $ string ; } else { return self :: NFC ( $ string ) ; } }
The ultimate convenience function! Clean up invalid UTF - 8 sequences and convert to normal form C canonical composition .
14,471
static function toNFC ( $ string ) { if ( NORMALIZE_INTL ) { return normalizer_normalize ( $ string , Normalizer :: FORM_C ) ; } elseif ( self :: quickIsNFC ( $ string ) ) { return $ string ; } else { return self :: NFC ( $ string ) ; } }
Convert a UTF - 8 string to normal form C canonical composition . Fast return for pure ASCII strings ; some lesser optimizations for strings containing only known - good characters .
14,472
static function toNFD ( $ string ) { if ( NORMALIZE_INTL ) { return normalizer_normalize ( $ string , Normalizer :: FORM_D ) ; } elseif ( preg_match ( '/[\x80-\xff]/' , $ string ) ) { return self :: NFD ( $ string ) ; } else { return $ string ; } }
Convert a UTF - 8 string to normal form D canonical decomposition . Fast return for pure ASCII strings .
14,473
static function toNFKC ( $ string ) { if ( NORMALIZE_INTL ) { return normalizer_normalize ( $ string , Normalizer :: FORM_KC ) ; } elseif ( preg_match ( '/[\x80-\xff]/' , $ string ) ) { return self :: NFKC ( $ string ) ; } else { return $ string ; } }
Convert a UTF - 8 string to normal form KC compatibility composition . This may cause irreversible information loss use judiciously . Fast return for pure ASCII strings .
14,474
static function toNFKD ( $ string ) { if ( NORMALIZE_INTL ) { return normalizer_normalize ( $ string , Normalizer :: FORM_KD ) ; } elseif ( preg_match ( '/[\x80-\xff]/' , $ string ) ) { return self :: NFKD ( $ string ) ; } else { return $ string ; } }
Convert a UTF - 8 string to normal form KD compatibility decomposition . This may cause irreversible information loss use judiciously . Fast return for pure ASCII strings .
14,475
static function fastCombiningSort ( $ string ) { self :: loadData ( ) ; $ len = strlen ( $ string ) ; $ out = '' ; $ combiners = [ ] ; $ lastClass = - 1 ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { $ c = $ string [ $ i ] ; $ n = ord ( $ c ) ; if ( $ n >= 0x80 ) { if ( $ n >= 0xf0 ) { $ c = substr ( $ string , $ i , 4 ) ; $ i += 3 ; } elseif ( $ n >= 0xe0 ) { $ c = substr ( $ string , $ i , 3 ) ; $ i += 2 ; } elseif ( $ n >= 0xc0 ) { $ c = substr ( $ string , $ i , 2 ) ; $ i ++ ; } if ( isset ( self :: $ utfCombiningClass [ $ c ] ) ) { $ lastClass = self :: $ utfCombiningClass [ $ c ] ; if ( isset ( $ combiners [ $ lastClass ] ) ) { $ combiners [ $ lastClass ] .= $ c ; } else { $ combiners [ $ lastClass ] = $ c ; } continue ; } } if ( $ lastClass ) { ksort ( $ combiners ) ; $ out .= implode ( '' , $ combiners ) ; $ combiners = [ ] ; } $ out .= $ c ; $ lastClass = 0 ; } if ( $ lastClass ) { ksort ( $ combiners ) ; $ out .= implode ( '' , $ combiners ) ; } return $ out ; }
Sorts combining characters into canonical order . This is the final step in creating decomposed normal forms D and KD .
14,476
static function placebo ( $ string ) { $ len = strlen ( $ string ) ; $ out = '' ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { $ out .= $ string [ $ i ] ; } return $ out ; }
This is just used for the benchmark comparing how long it takes to interate through a string without really doing anything of substance .
14,477
private static function replaceForNativeNormalize ( $ string ) { $ string = preg_replace ( '/[\x00-\x08\x0b\x0c\x0e-\x1f]/' , Constants :: UTF8_REPLACEMENT , $ string ) ; $ string = str_replace ( Constants :: UTF8_FFFE , Constants :: UTF8_REPLACEMENT , $ string ) ; $ string = str_replace ( Constants :: UTF8_FFFF , Constants :: UTF8_REPLACEMENT , $ string ) ; return $ string ; }
Function to replace some characters that we don t want but most of the native normalize functions keep .
14,478
public function seeRedirectBetween ( $ oldUrl , $ newUrl , $ statusCode ) { $ followsRedirects = $ this -> isFollowingRedirects ( ) ; $ this -> followRedirects ( false ) ; $ response = $ this -> sendHeadAndGetResponse ( $ oldUrl ) ; if ( null !== $ response ) { $ responseCode = $ response -> getStatus ( ) ; $ locationHeader = $ response -> getHeader ( 'Location' , true ) ; $ this -> assertEquals ( $ statusCode , $ responseCode , 'Response code was not ' . $ statusCode . '.' ) ; $ this -> assertContains ( $ newUrl , $ locationHeader , 'Redirect destination not found in Location header.' ) ; } $ this -> followRedirects ( $ followsRedirects ) ; }
Check that a redirection occurs .
14,479
public function urlDoesNotRedirect ( $ url ) { if ( '/' === $ url ) { $ url = '' ; } $ followsRedirects = $ this -> isFollowingRedirects ( ) ; $ this -> followRedirects ( false ) ; $ response = $ this -> sendHeadAndGetResponse ( $ url ) ; if ( null !== $ response ) { $ responseCode = $ response -> getStatus ( ) ; $ locationHeader = $ response -> getHeader ( 'Location' , true ) ; $ this -> assertEquals ( 200 , $ responseCode , 'Response code was not 200.' ) ; $ this -> assertNull ( $ locationHeader , 'Location header was found when it should not exist.' ) ; } $ this -> followRedirects ( $ followsRedirects ) ; }
Check that a 200 HTTP Status is returned and the URL has no redirects .
14,480
protected function sendHeadAndGetResponse ( $ url ) { $ rest = $ this -> getModule ( 'REST' ) ; $ rest -> sendHEAD ( $ url ) ; return $ rest -> client -> getInternalResponse ( ) ; }
Use REST Module to send HEAD request and return the response .
14,481
public function setCalendarConfig ( $ arg1 , $ arg2 = null ) { if ( is_array ( $ arg1 ) ) { $ this -> calendarConfig = $ arg1 ; } else { $ this -> calendarConfig [ $ arg1 ] = $ arg2 ; } return $ this ; }
Defines either the named calendar config value or the calendar config array .
14,482
public function getCalendarConfig ( $ name = null ) { if ( ! is_null ( $ name ) ) { return isset ( $ this -> calendarConfig [ $ name ] ) ? $ this -> calendarConfig [ $ name ] : null ; } return $ this -> calendarConfig ; }
Answers either the named calendar config value or the calendar config array .
14,483
public function updateAttributes ( & $ attributes ) { $ attributes [ 'data-calendar-config' ] = $ this -> owner -> getCalendarConfigJSON ( ) ; $ attributes [ 'data-calendar-enabled' ] = $ this -> owner -> getCalendarEnabled ( ) ; }
Updates the given array of HTML attributes from the extended object .
14,484
public function getCalendarEnabled ( ) { if ( $ this -> owner -> isReadonly ( ) || $ this -> owner -> isDisabled ( ) ) { return 'false' ; } return ( $ this -> calendarDisabled || $ this -> owner -> config ( ) -> calendar_disabled ) ? 'false' : 'true' ; }
Answers true if the calendar is enabled for the extended object .
14,485
public function getImageCount ( $ pageNumber ) { $ strURI = Product :: $ baseProductUri . '/pdf/' . $ this -> getFileName ( ) . '/pages/' . $ pageNumber . '/images' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; return count ( $ json -> Images -> List ) ; }
Gets number of images in a specified page .
14,486
public static function compare ( Item $ a , Item $ b ) : int { return Symbol :: compare ( $ a -> subject , $ b -> subject ) ? : Symbol :: compareList ( $ a -> passed , $ b -> passed ) ? : Symbol :: compareList ( $ a -> further , $ b -> further ) ? : ( $ b -> eof - $ a -> eof ) ; }
Compare two items
14,487
public static function createFromRule ( Rule $ rule ) : self { return new static ( $ rule -> getSubject ( ) , [ ] , $ rule -> getDefinition ( ) , $ rule -> hasEofMark ( ) , $ rule -> getTag ( ) ) ; }
Create Item from a Rule
14,488
public function shift ( ) : ? self { $ further = $ this -> further ; if ( ! $ further ) { return null ; } $ passed = $ this -> passed ; $ passed [ ] = array_shift ( $ further ) ; return new static ( $ this -> subject , $ passed , $ further , $ this -> eof , $ this -> tag ) ; }
Create new Item by shifting current position to the next symbol
14,489
public function getAsRule ( ) : Rule { return new Rule ( $ this -> subject , array_merge ( $ this -> passed , $ this -> further ) , $ this -> eof , $ this -> tag ) ; }
Reconstruct a source rule
14,490
private function getAudio ( ) { $ audioUrl = 'http://file.api.wechat.com/cgi-bin/media/get?access_token=' . $ this -> getAccessToken ( ) . '&media_id=' . $ this -> event -> get ( 'MediaId' ) ; return [ new Audio ( $ audioUrl , $ this -> event ) ] ; }
Retrieve audio url from an incoming message .
14,491
public function getFile ( $ fileName , $ storageName = '' ) { if ( $ fileName == '' ) { AsposeApp :: getLogger ( ) -> error ( Exception :: MSG_NO_FILENAME ) ; throw new Exception ( Exception :: MSG_NO_FILENAME ) ; } $ strURI = $ this -> strURIFile . $ fileName ; if ( $ storageName != '' ) { $ strURI .= '?storage=' . $ storageName ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ outputPath = AsposeApp :: $ outPutLocation . basename ( $ fileName ) ; Utils :: saveFile ( $ responseStream , $ outputPath ) ; return $ outputPath ; }
Gets a file from Aspose storage .
14,492
public function copyFile ( $ fileName , $ storageName = '' , $ newDest ) { if ( $ fileName == '' || $ newDest == '' ) { AsposeApp :: getLogger ( ) -> error ( Exception :: MSG_NO_FILENAME ) ; throw new Exception ( Exception :: MSG_NO_FILENAME ) ; } $ strURI = $ this -> strURIFile . $ fileName . '?newdest=' . $ newDest ; if ( $ storageName != '' ) { $ strURI .= '&storage=' . $ storageName ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'PUT' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code === 200 ) { return true ; } return false ; }
Copies a file in Aspose storage to a new destination
14,493
public function findText ( ) { $ parameters = func_get_args ( ) ; if ( count ( $ parameters ) == 1 ) { $ text = $ parameters [ 0 ] ; } else if ( count ( $ parameters ) == 2 ) { $ WorkSheetName = $ parameters [ 0 ] ; $ text = $ parameters [ 1 ] ; } else { throw new Exception ( 'Invalid number of arguments' ) ; } $ strURI = Product :: $ baseProductUri . '/cells/' . $ this -> getFileName ( ) . ( ( count ( $ parameters ) == 2 ) ? '/worksheets/' . $ WorkSheetName : '' ) . '/findText?text=' . $ text ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'POST' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; return $ json -> TextItems -> TextItemList ; }
Finds a speicif text from Excel document or a worksheet .
14,494
public function getTextItems ( ) { $ parameters = func_get_args ( ) ; if ( count ( $ parameters ) > 0 ) { $ worksheetName = $ parameters [ 0 ] ; } $ strURI = Product :: $ baseProductUri . '/cells/' . $ this -> getFileName ( ) . ( ( isset ( $ parameters [ 0 ] ) ) ? '/worksheets/' . $ worksheetName . '/textItems' : '/textItems' ) ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; return $ json -> TextItems -> TextItemList ; }
Gets text items from the whole Excel file or a specific worksheet .
14,495
public function getMaximumInstallmentQuantity ( ) { $ product = $ this -> getProduct ( ) ? $ this -> getProduct ( ) : $ this -> getParentBlock ( ) -> getProduct ( ) ; $ maximumInstallment = $ this -> getMaximumInstallment ( $ product ) ; return $ maximumInstallment -> getMaximumInstallmentsQuantity ( ) ; }
Gets maximum installment quantity for current product
14,496
public function parse ( string $ input , $ actions = [ ] ) : TreeNodeInterface { if ( $ actions instanceof ActionsMap ) { $ actions_map = $ actions ; } elseif ( $ actions ) { $ actions_map = new ActionsMap ( $ actions ) ; } else { $ actions_map = null ; } $ stack = new Stack ( $ this -> table , $ actions_map ) ; $ pos = 0 ; $ token = null ; try { while ( true ) { while ( $ stack -> getStateRow ( ) -> isReduceOnly ( ) ) { $ stack -> reduce ( ) ; } $ expected_terms = array_keys ( $ stack -> getStateRow ( ) -> terminalActions ) ; $ match = $ this -> grammar -> parseOne ( $ input , $ pos , $ expected_terms ) ; if ( $ match ) { $ token = $ match -> token ; $ pos = $ match -> nextOffset ; $ symbol_name = $ token -> getType ( ) ; } else { $ token = null ; $ symbol_name = null ; } while ( true ) { if ( $ token ) { $ terminal_actions = $ stack -> getStateRow ( ) -> terminalActions ; if ( isset ( $ terminal_actions [ $ symbol_name ] ) ) { $ stack -> shift ( $ token , $ terminal_actions [ $ symbol_name ] ) ; goto NEXT_SYMBOL ; } } if ( $ stack -> getStateRow ( ) -> eofAction ) { if ( $ token ) { throw new UnexpectedInputAfterEndException ( $ this -> dumpTokenForError ( $ token ) , $ token -> getOffset ( ) ) ; } goto DONE ; } $ stack -> reduce ( ) ; } NEXT_SYMBOL : } DONE : } catch ( AbortParsingException $ e ) { throw new AbortedException ( $ e -> getMessage ( ) , $ e -> getOffset ( ) , $ e -> getPrevious ( ) ) ; } catch ( NoReduceException $ e ) { $ expected_terminals = [ ] ; foreach ( $ stack -> getStateRow ( ) -> terminalActions as $ name => $ _ ) { $ expected_terminals [ ] = Symbol :: dumpType ( $ name ) ; } throw new UnexpectedTokenException ( $ this -> dumpTokenForError ( $ token ) , $ expected_terminals , $ token ? $ token -> getOffset ( ) : strlen ( $ input ) ) ; } catch ( StateException $ e ) { throw new InternalException ( 'Unexpected state fail' , 0 , $ e ) ; } $ tokens_gen = null ; return $ stack -> done ( ) ; }
Parse input text into nodes tree
14,497
public function addChart ( $ chartType , $ upperLeftRow , $ upperLeftColumn , $ lowerRightRow , $ lowerRightColumn ) { if ( $ this -> worksheetName == '' ) throw new Exception ( 'Worksheet name not specified' ) ; $ strURI = Product :: $ baseProductUri . '/cells/' . $ this -> getFileName ( ) . '/worksheets/' . $ this -> worksheetName . '/charts?chartType=' . $ chartType . '&upperLeftRow=' . $ upperLeftRow . '&upperLeftColumn=' . $ upperLeftColumn . '&lowerRightRow=' . $ lowerRightRow . '&lowerRightColumn=' . $ lowerRightColumn ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'PUT' , '' , '' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { $ folder = new Folder ( ) ; $ outputStream = $ folder -> GetFile ( $ this -> getFileName ( ) ) ; $ outputPath = AsposeApp :: $ outPutLocation . $ this -> getFileName ( ) ; Utils :: saveFile ( $ outputStream , $ outputPath ) ; return $ outputPath ; } else return $ v_output ; }
Adds a new chart .
14,498
public function deleteCharts ( ) { if ( $ this -> worksheetName == '' ) throw new Exception ( 'Worksheet name not specified' ) ; $ strURI = Product :: $ baseProductUri . '/cells/' . $ this -> getFileName ( ) . '/worksheets/' . $ this -> worksheetName . '/charts/' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'DELETE' , '' , '' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { $ folder = new Folder ( ) ; $ outputStream = $ folder -> GetFile ( $ this -> getFileName ( ) ) ; $ outputPath = AsposeApp :: $ outPutLocation . $ this -> getFileName ( ) ; Utils :: saveFile ( $ outputStream , $ outputPath ) ; return $ outputPath ; } else return $ v_output ; }
Deletes all charts .
14,499
public function readChartLegend ( $ chartIndex ) { if ( $ this -> worksheetName == '' ) throw new Exception ( 'Worksheet name not specified' ) ; $ strURI = Product :: $ baseProductUri . '/cells/' . $ this -> getFileName ( ) . '/worksheets/' . $ this -> worksheetName . '/charts/' . $ chartIndex . '/legend' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , 'json' , '' ) ; $ json = json_decode ( $ responseStream ) ; return $ json -> Legend ; }
Get chart legend .