idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
11,400
public function getLanguagesForNode ( NodeInterface $ node ) { $ languages = [ ] ; foreach ( $ node -> getProperties ( ) as $ property ) { preg_match ( '/^' . $ this -> languageNamespace . ':([a-zA-Z_]*?)-changer/' , $ property -> getName ( ) , $ matches ) ; if ( $ matches ) { $ languages [ $ matches [ 1 ] ] = $ matche...
Return the languages that are currently registered on the given PHPCR node .
11,401
public function getStructureTypeForNode ( NodeInterface $ node ) { $ mixinTypes = $ node -> getPropertyValueWithDefault ( 'jcr:mixinTypes' , [ ] ) ; if ( in_array ( 'sulu:' . Structure :: TYPE_PAGE , $ mixinTypes ) ) { return Structure :: TYPE_PAGE ; } if ( in_array ( 'sulu:' . Structure :: TYPE_SNIPPET , $ mixinTypes ...
Return the structure type for the given node .
11,402
public function getBaseSnippetPath ( $ type = null ) { $ path = '/' . $ this -> getPath ( 'base' ) . '/' . $ this -> getPath ( 'snippet' ) ; if ( $ type ) { $ path .= '/' . $ type ; } return $ path ; }
Returns the path for the base snippet of the given type resp . of all types if not given .
11,403
public function getBaseSnippetUuid ( $ type = null ) { try { return $ this -> session -> getNode ( $ this -> getBaseSnippetPath ( $ type ) ) -> getIdentifier ( ) ; } catch ( PathNotFoundException $ e ) { $ snippetStructures = array_map ( function ( StructureMetadata $ structureMetadata ) { return $ structureMetadata ->...
Returns the uuid for the base snippet of the given type resp . of all types if not given .
11,404
public function extractSnippetTypeFromPath ( $ path ) { if ( '/' !== substr ( $ path , 0 , 1 ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Path must be absolute, got "%s"' , $ path ) ) ; } $ snippetsPath = $ this -> getBaseSnippetPath ( ) . '/' ; $ newPath = PathHelper :: getParentPath ( $ path ) ; $ newPath ...
Extract the snippet path from the given path .
11,405
public function getTranslatedProperty ( $ property , $ locale , $ prefix = null ) { return new TranslatedProperty ( $ property , $ locale , $ this -> languageNamespace , $ prefix ) ; }
Return translated property .
11,406
public function getValues ( ) { $ values = $ this -> entity -> getValues ( ) ; $ result = [ ] ; if ( $ values ) { foreach ( $ values as $ value ) { $ result [ ] = new OperatorValue ( $ value , $ this -> locale ) ; } return $ result ; } return ; }
Get values .
11,407
public function onResponse ( FilterResponseEvent $ event ) { if ( $ this -> preview || 0 !== strpos ( $ event -> getResponse ( ) -> headers -> get ( 'Content-Type' ) , 'text/html' ) || null === $ this -> requestAnalyzer -> getPortalInformation ( ) ) { return ; } $ portalUrl = $ this -> requestAnalyzer -> getAttribute (...
Appends analytics scripts into body .
11,408
protected function generateAnalyticsContent ( array $ analyticsContent , Analytics $ analytics ) { foreach ( array_keys ( self :: $ positions ) as $ position ) { $ template = 'SuluWebsiteBundle:Analytics:' . $ analytics -> getType ( ) . '/' . $ position . '.html.twig' ; if ( ! $ this -> engine -> exists ( $ template ) ...
Generate content for each possible position .
11,409
protected function setAnalyticsContent ( $ responseContent , array $ analyticsContent ) { foreach ( $ analyticsContent as $ id => $ content ) { if ( ! $ content ) { continue ; } $ responseContent = preg_replace ( self :: $ positions [ $ id ] [ 'regex' ] , sprintf ( self :: $ positions [ $ id ] [ 'sprintf' ] , $ content...
Set the generated content for each position .
11,410
public function setFilter ( \ Sulu \ Bundle \ ResourceBundle \ Entity \ Filter $ filter ) { $ this -> filter = $ filter ; return $ this ; }
Set filter .
11,411
private function getUniqueFileName ( string $ folder , string $ fileName , int $ counter = 0 ) : string { $ newFileName = $ fileName ; if ( $ counter > 0 ) { $ fileNameParts = explode ( '.' , $ fileName , 2 ) ; $ newFileName = $ fileNameParts [ 0 ] . '-' . $ counter ; if ( isset ( $ fileNameParts [ 1 ] ) ) { $ newFileN...
Get a unique filename in path .
11,412
public function cgetAction ( Request $ request ) { $ locale = $ this -> getLocale ( $ request ) ; $ type = $ request -> query -> get ( 'type' , null ) ? : null ; $ idsString = $ request -> get ( 'ids' ) ; if ( $ idsString ) { $ ids = explode ( ',' , $ idsString ) ; $ snippets = $ this -> snippetRepository -> getSnippet...
Returns list of snippets .
11,413
public function getAction ( Request $ request , $ id = null ) { $ locale = $ this -> getLocale ( $ request ) ; $ snippet = $ this -> findDocument ( $ id , $ locale ) ; $ view = View :: create ( $ snippet ) ; return $ this -> viewHandler -> handle ( $ view ) ; }
Returns snippet by ID .
11,414
public function postAction ( Request $ request ) { $ document = $ this -> documentManager -> create ( Structure :: TYPE_SNIPPET ) ; $ form = $ this -> processForm ( $ request , $ document ) ; return $ this -> handleView ( $ form -> getData ( ) ) ; }
Saves a new snippet .
11,415
public function putAction ( Request $ request , $ id ) { $ document = $ this -> findDocument ( $ id , $ this -> getLocale ( $ request ) ) ; $ this -> requestHashChecker -> checkHash ( $ request , $ document , $ document -> getUuid ( ) ) ; if ( ! $ this -> checkAreaSnippet ( $ request , $ document ) ) { return new JsonR...
Saves a new existing snippet .
11,416
public function deleteAction ( Request $ request , $ id ) { $ locale = $ this -> getLocale ( $ request ) ; $ webspaceKey = $ request -> query -> get ( 'webspace' , null ) ; $ references = $ this -> snippetRepository -> getReferences ( $ id ) ; if ( count ( $ references ) > 0 ) { $ force = $ request -> headers -> get ( ...
Deletes an existing Snippet .
11,417
public function postTriggerAction ( $ id , Request $ request ) { $ view = null ; $ snippet = null ; $ locale = $ this -> getLocale ( $ request ) ; $ action = $ this -> getRequestParameter ( $ request , 'action' , true ) ; try { switch ( $ action ) { case 'copy-locale' : $ destLocales = explode ( ',' , $ this -> getRequ...
trigger a action for given snippet specified over get - action parameter .
11,418
private function decorateSnippet ( array $ snippet , $ locale ) { return array_merge ( $ snippet , [ '_links' => [ 'self' => $ this -> urlGenerator -> generate ( 'get_snippet' , [ 'id' => $ snippet [ 'id' ] , 'language' => $ locale ] ) , 'delete' => $ this -> urlGenerator -> generate ( 'delete_snippet' , [ 'id' => $ sn...
Decorate snippet for HATEOAS .
11,419
private function getReferentialIntegrityResponse ( $ webspace , $ references , $ id , $ locale ) { $ data = [ 'structures' => [ ] , 'other' => [ ] , 'isDefault' => $ this -> defaultSnippetManager -> isDefault ( $ id ) , ] ; foreach ( $ references as $ reference ) { if ( $ reference -> getParent ( ) -> isNodeType ( 'sul...
Return a response for the case where there is an referential integrity violation .
11,420
private function createSql2Query ( $ sql2 , $ limit = null , $ offset = null ) { $ queryManager = $ this -> sessionManager -> getSession ( ) -> getWorkspace ( ) -> getQueryManager ( ) ; $ query = $ queryManager -> createQuery ( $ sql2 , 'JCR-SQL2' ) ; if ( $ limit ) { $ query -> setLimit ( $ limit ) ; } if ( $ offset )...
returns a sql2 query .
11,421
public function handlePersist ( PersistEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! ( $ document instanceof CustomUrlBehavior ) ) { return ; } $ webspaceKey = $ this -> inspector -> getWebspace ( $ document ) ; $ domain = $ this -> generator -> generate ( $ document -> getBaseDomain ( ) , $ docume...
Creates routes for persisted custom - url .
11,422
protected function createRoute ( $ domain , CustomUrlBehavior $ document , Localization $ locale , $ persistedLocale , $ routesPath ) { $ path = sprintf ( '%s/%s' , $ routesPath , $ domain ) ; $ routeDocument = $ this -> findOrCreateRoute ( $ path , $ persistedLocale , $ document , $ domain ) ; $ routeDocument -> setTa...
Create route - document for given domain .
11,423
protected function findOrCreateRoute ( $ path , $ locale , CustomUrlBehavior $ document , $ route ) { try { $ routeDocument = $ this -> documentManager -> find ( $ path , $ locale ) ; } catch ( DocumentNotFoundException $ ex ) { return $ this -> documentManager -> create ( 'custom_url_route' ) ; } if ( ! $ routeDocumen...
Find or create route - document for given path .
11,424
public function handleRemove ( RemoveEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! ( $ document instanceof CustomUrlBehavior ) ) { return ; } foreach ( $ this -> inspector -> getReferrers ( $ document ) as $ referrer ) { if ( $ referrer instanceof RouteBehavior ) { $ this -> documentManager -> remo...
Removes the routes for the given document .
11,425
public function findByUrlAndEnvironment ( $ url , $ environment ) { $ queryBuilder = $ this -> createQueryBuilder ( 'u' ) -> where ( 'u.url = :url' ) -> andWhere ( 'u.environment = :environment' ) ; $ query = $ queryBuilder -> getQuery ( ) ; $ query -> setParameter ( 'url' , $ url ) ; $ query -> setParameter ( 'environ...
Returns domain with given url and environment .
11,426
private function getHostLength ( ) { $ hostLength = strpos ( $ this -> url , '/' ) ; $ hostLength = ( false === $ hostLength ) ? strlen ( $ this -> url ) : $ hostLength ; return $ hostLength ; }
Calculate the length of the host part of the URL .
11,427
protected function createMask ( $ maskPath , $ width , $ height ) { $ mask = $ this -> imagine -> open ( $ maskPath ) ; $ mask -> resize ( new Box ( $ width ? : 1 , $ height ? : 1 ) ) ; return $ mask ; }
Create mask .
11,428
public function addConfigParams ( JsConfigInterface $ params ) { $ this -> pool = array_merge ( $ this -> pool , [ $ params -> getName ( ) => $ params -> getParameters ( ) ] ) ; }
Adds a new config parameter .
11,429
private function loadPropertyMetadata ( \ DOMXPath $ xpath , \ DOMNode $ propertyNode ) { $ propertyMetadata = null ; switch ( $ propertyNode -> nodeName ) { case 'concatenation-property' : $ propertyMetadata = $ this -> loadConcatenationPropertyMetadata ( $ xpath , $ propertyNode ) ; break ; case 'identity-property' :...
Extracts attributes from dom - node to create a new property - metadata object .
11,430
protected function getFilterTypeParameters ( \ DOMXPath $ xpath , \ DOMNode $ propertyNode ) { $ parameters = [ ] ; foreach ( $ xpath -> query ( 'x:filter-type-parameters/x:parameter' , $ propertyNode ) as $ parameterNode ) { $ key = XmlUtil :: getValueFromXPath ( '@key' , $ xpath , $ parameterNode ) ; $ parameters [ $...
Extracts filter type parameters from dom - node .
11,431
public function queryAction ( Request $ request ) { $ geolocatorName = $ request -> get ( 'providerName' ) ; $ query = $ request -> get ( 'query' ) ; try { $ geolocator = $ this -> geolocatorManager -> get ( $ geolocatorName ) ; } catch ( GeolocatorNotFoundException $ e ) { throw new NotFoundHttpException ( sprintf ( '...
Query the configured geolocation service .
11,432
private function preload ( $ attributesByTag , $ locale , $ published = true ) { $ hrefsByType = [ ] ; foreach ( $ attributesByTag as $ attributes ) { $ provider = $ this -> getValue ( $ attributes , 'provider' , self :: DEFAULT_PROVIDER ) ; if ( ! array_key_exists ( $ provider , $ hrefsByType ) ) { $ hrefsByType [ $ p...
Return items for given attributes .
11,433
private function getValue ( array $ attributes , $ name , $ default = null ) { if ( array_key_exists ( $ name , $ attributes ) && ! empty ( $ attributes [ $ name ] ) ) { return $ attributes [ $ name ] ; } return $ default ; }
Returns attribute identified by name or default if not exists .
11,434
private function getBasePath ( $ uuid = null , $ default = 1 ) { if ( null !== $ uuid ) { return str_replace ( '{uuid}' , $ uuid , $ this -> apiBasePath [ 2 ] ) ; } else { return $ this -> apiBasePath [ $ default ] ; } }
returns base path fo given uuid .
11,435
private function getSnippets ( PropertyInterface $ property ) { $ page = $ property -> getStructure ( ) ; $ webspaceKey = $ page -> getWebspaceKey ( ) ; $ locale = $ page -> getLanguageCode ( ) ; $ shadowLocale = null ; if ( $ page -> getIsShadow ( ) ) { $ shadowLocale = $ page -> getShadowBaseLanguage ( ) ; } $ refs =...
Returns snippets with given property value .
11,436
private function getParameterValue ( array $ parameter , $ name , $ default = null ) { if ( ! array_key_exists ( $ name , $ parameter ) ) { return $ default ; } return $ parameter [ $ name ] -> getValue ( ) ; }
Returns value of parameter . If parameter not exists the default will be returned .
11,437
protected function getPropertyData ( PropertyMetadata $ property , $ propertyValue ) { return $ this -> createProperty ( $ property -> getName ( ) , $ this -> exportManager -> export ( $ property -> getType ( ) , $ propertyValue ) , $ this -> exportManager -> getOptions ( $ property -> getType ( ) , $ this -> format ) ...
Creates and returns a property - array .
11,438
protected function getBlockPropertyData ( BlockMetadata $ property , $ propertyValue ) { $ children = [ ] ; $ blockDataList = $ this -> exportManager -> export ( $ property -> getType ( ) , $ propertyValue ) ; foreach ( $ blockDataList as $ blockData ) { $ blockType = $ blockData [ 'type' ] ; $ block = $ this -> getPro...
Creates and Returns a property - array for content - type Block .
11,439
protected function getPropertiesContentData ( $ properties , $ propertyValues ) { $ contentData = [ ] ; foreach ( $ properties as $ property ) { if ( $ this -> exportManager -> hasExport ( $ property -> getType ( ) , $ this -> format ) ) { if ( ! isset ( $ propertyValues [ $ property -> getName ( ) ] ) ) { continue ; }...
Returns the Content as a flat array .
11,440
protected function getContentData ( $ document , $ locale ) { $ loadedDocument = $ this -> documentManager -> find ( $ document -> getUuid ( ) , $ locale ) ; $ metaData = $ this -> documentInspector -> getStructureMetadata ( $ document ) ; $ propertyValues = $ loadedDocument -> getStructure ( ) -> toArray ( ) ; $ prope...
Returns a array of the given content data of the document .
11,441
protected function getTemplate ( $ format ) { if ( ! isset ( $ this -> formatFilePaths [ $ format ] ) ) { throw new \ Exception ( sprintf ( 'No format "%s" configured for Snippet export' , $ format ) ) ; } $ templatePath = $ this -> formatFilePaths [ $ format ] ; if ( ! $ this -> templating -> exists ( $ templatePath )...
Returns export template for given format like XLIFF1 . 2 .
11,442
private function persistReference ( NodeInterface $ node , DocumentAccessor $ accessor , $ fieldName , $ locale , $ fieldMapping ) { $ referenceDocument = $ accessor -> get ( $ fieldName ) ; if ( ! $ referenceDocument ) { return ; } if ( $ fieldMapping [ 'multiple' ] ) { throw new \ InvalidArgumentException ( sprintf (...
Persist a reference field type .
11,443
private function persistGeneric ( NodeInterface $ node , DocumentAccessor $ accessor , $ fieldName , $ locale , array $ fieldMapping ) { try { $ phpcrName = $ this -> encoder -> encode ( $ fieldMapping [ 'encoding' ] , $ fieldMapping [ 'property' ] , $ locale ) ; $ value = $ accessor -> get ( $ fieldName ) ; $ this -> ...
Persist scalar field types .
11,444
private function hydrateReferenceField ( NodeInterface $ node , $ document , DocumentAccessor $ accessor , $ fieldName , $ locale , array $ fieldMapping , array $ options ) { try { $ phpcrName = $ this -> encoder -> encode ( $ fieldMapping [ 'encoding' ] , $ fieldMapping [ 'property' ] , $ locale ) ; $ referencedNode =...
Hydrate reference field types .
11,445
private function hydrateGenericField ( NodeInterface $ node , DocumentAccessor $ accessor , $ fieldName , $ locale , array $ fieldMapping ) { try { $ phpcrName = $ this -> encoder -> encode ( $ fieldMapping [ 'encoding' ] , $ fieldMapping [ 'property' ] , $ locale ) ; $ value = $ node -> getPropertyValueWithDefault ( $...
Hydrate scalar field types .
11,446
private function appendPortalInformation ( Webspace $ webspace , Context $ context , JsonSerializationVisitor $ visitor ) { $ portalInformation = $ this -> webspaceManager -> getPortalInformationsByWebspaceKey ( $ this -> environment , $ webspace -> getKey ( ) ) ; $ portalInformation = $ context -> accept ( array_value...
Extract portal - information and add them to serialization .
11,447
private function appendUrls ( Webspace $ webspace , Context $ context , JsonSerializationVisitor $ visitor ) { $ urls = $ this -> webspaceUrlProvider -> getUrls ( $ webspace , $ this -> environment ) ; $ urls = $ context -> accept ( $ urls ) ; $ visitor -> addData ( 'urls' , $ urls ) ; }
Extract urls and add them to serialization .
11,448
private function appendCustomUrls ( Webspace $ webspace , Context $ context , JsonSerializationVisitor $ visitor ) { $ customUrls = [ ] ; foreach ( $ webspace -> getPortals ( ) as $ portal ) { $ customUrls = array_merge ( $ customUrls , $ this -> getCustomUrlsForEnvironment ( $ portal , $ portal -> getEnvironment ( $ t...
Extract custom - url and add them to serialization .
11,449
private function getCustomUrlsForEnvironment ( Portal $ portal , Environment $ environment , Context $ context ) { $ customUrls = [ ] ; foreach ( $ environment -> getCustomUrls ( ) as $ customUrl ) { $ customUrl = $ context -> accept ( $ customUrl ) ; $ customUrl [ 'locales' ] = $ context -> accept ( $ portal -> getLoc...
Returns custom - url data with the connected locales .
11,450
public function onHit ( HitEvent $ event ) { if ( false === $ event -> getMetadata ( ) -> reflection -> isSubclassOf ( BasePageDocument :: class ) ) { return ; } $ document = $ event -> getHit ( ) -> getDocument ( ) ; if ( '/' !== $ document -> getUrl ( ) [ 0 ] ) { return ; } $ url = sprintf ( '%s/%s' , rtrim ( $ this ...
Prefix url of document with current resourcelocator prefix .
11,451
public function onPostSerialize ( ObjectEvent $ event ) { $ visitor = $ event -> getVisitor ( ) ; $ document = $ event -> getObject ( ) ; if ( ! $ document instanceof PathBehavior || ! $ this -> documentRegistry -> hasDocument ( $ document ) ) { return ; } $ visitor -> addData ( 'path' , $ this -> documentInspector -> ...
Adds the relative path to the serialization .
11,452
public function cgetAction ( Request $ request ) { $ checkForPermissions = $ request -> get ( 'checkForPermissions' , true ) ; $ locale = $ this -> getRequestParameter ( $ request , 'locale' , true ) ; $ webspaces = [ ] ; $ securityChecker = $ this -> get ( 'sulu_security.security_checker' ) ; foreach ( $ this -> get (...
Returns webspaces .
11,453
public function getAction ( $ webspaceKey ) { return $ this -> handleView ( $ this -> view ( $ this -> get ( 'sulu_core.webspace.webspace_manager' ) -> findWebspaceByKey ( $ webspaceKey ) ) ) ; }
Returns webspace config by key .
11,454
public function getItemsAction ( Request $ request ) { $ providerAlias = $ this -> getRequestParameter ( $ request , 'provider' , true ) ; $ filters = $ request -> query -> all ( ) ; $ filters [ 'excluded' ] = array_filter ( explode ( ',' , $ this -> getRequestParameter ( $ request , 'excluded' ) ) ) ; if ( isset ( $ f...
Resolves filter for smart - content UI .
11,455
private function getParams ( array $ params ) { $ result = [ ] ; foreach ( $ params as $ name => $ item ) { $ value = $ item [ 'value' ] ; if ( 'collection' === $ item [ 'type' ] ) { $ value = $ this -> getParams ( $ value ) ; } $ result [ $ name ] = new PropertyParameter ( $ name , $ value , $ item [ 'type' ] ) ; } re...
Returns property - parameter .
11,456
private function addHistoryRedirectToRouteCollection ( Request $ request , RouteDocument $ routeDocument , RouteCollection $ collection , $ webspaceKey ) { $ resourceSegment = PathHelper :: relativizePath ( $ routeDocument -> getTargetDocument ( ) -> getPath ( ) , $ this -> getRoutesPath ( $ webspaceKey ) ) ; $ url = s...
Add redirect to current custom - url .
11,457
private function loadPaginated ( array $ options , $ limit , $ page , $ pageSize ) { $ pageSize = intval ( $ pageSize ) ; $ offset = ( $ page - 1 ) * $ pageSize ; $ position = $ pageSize * $ page ; if ( null !== $ limit && $ position >= $ limit ) { $ pageSize = $ limit - $ offset ; $ loadLimit = $ pageSize ; } else { $...
Load paginated data .
11,458
public function handlePreRemove ( RemoveEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ document ) ) { return ; } $ event = $ this -> getDeleteEvent ( $ document ) ; $ this -> deleteEvents [ spl_object_hash ( $ document ) ] = $ event ; $ this -> eventDispatcher -> dispatch ( Co...
Dispatches the deprecated pre remove event .
11,459
public function handlePostRemove ( RemoveEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ document ) ) { return ; } $ oid = spl_object_hash ( $ document ) ; $ event = $ this -> deleteEvents [ $ oid ] ; $ this -> eventDispatcher -> dispatch ( ContentEvents :: NODE_POST_DELETE , $...
Dispatches the deprected post remove event .
11,460
public function handlePersist ( PersistEvent $ event ) { if ( ! $ this -> supports ( $ event -> getDocument ( ) ) ) { return ; } $ this -> persistEvents [ ] = $ event ; }
Saves all persisted documents to dispatch the deprecated post save event later when flushed .
11,461
public function handleFlush ( FlushEvent $ event ) { foreach ( $ this -> persistEvents as $ persistEvent ) { $ document = $ persistEvent -> getDocument ( ) ; $ structure = $ this -> documentToStructure ( $ document ) ; $ event = new ContentNodeEvent ( $ this -> documentInspector -> getNode ( $ document ) , $ structure ...
Dispatches the deprecated post save event for every persisted document .
11,462
public function addEmail ( \ Sulu \ Bundle \ ContactBundle \ Entity \ Email $ emails ) { $ this -> emails [ ] = $ emails ; return $ this ; }
Add emails .
11,463
public function removeEmail ( \ Sulu \ Bundle \ ContactBundle \ Entity \ Email $ emails ) { $ this -> emails -> removeElement ( $ emails ) ; }
Remove emails .
11,464
protected function loadStructureTags ( $ path , $ xpath ) { $ result = [ ] ; foreach ( $ xpath -> query ( $ path ) as $ node ) { $ tag = [ 'name' => null , 'attributes' => [ ] , ] ; foreach ( $ node -> attributes as $ key => $ attr ) { if ( in_array ( $ key , [ 'name' ] ) ) { $ tag [ $ key ] = $ attr -> value ; } else ...
Loads the tags for the structure .
11,465
protected function loadStructureAreas ( $ path , $ xpath ) { $ result = [ ] ; foreach ( $ xpath -> query ( $ path ) as $ node ) { $ area = [ ] ; foreach ( $ node -> attributes as $ key => $ attr ) { if ( in_array ( $ key , [ 'key' ] ) ) { $ area [ $ key ] = $ attr -> value ; } else { $ area [ 'attributes' ] [ $ key ] =...
Loads the areas for the structure .
11,466
private function getSystem ( ) { $ system = $ this -> suluSystem ; $ request = $ this -> requestStack -> getCurrentRequest ( ) ; if ( null !== $ request && $ request -> attributes -> has ( '_sulu' ) && null !== ( $ webspace = $ request -> attributes -> get ( '_sulu' ) -> getAttribute ( 'webspace' ) ) && null !== ( $ se...
Returns the required system for the current request .
11,467
private function iterateRouteNodes ( NodeInterface $ node , $ callback , $ webspaceKey , $ languageCode , $ segmentKey = null ) { if ( $ node -> isNew ( ) ) { return null ; } $ routePath = $ this -> sessionManager -> getRoutePath ( $ webspaceKey , $ languageCode ) ; foreach ( $ node -> getReferences ( 'sulu:content' ) ...
Iterates over all route nodes assigned by the given node and executes the callback on it .
11,468
private function getWebspaceRouteNode ( $ webspaceKey , $ languageCode , $ segmentKey ) { return $ this -> sessionManager -> getRouteNode ( $ webspaceKey , $ languageCode , $ segmentKey ) ; }
Returns base node of routes from phpcr .
11,469
private function getWebspaceRouteNodeBasePath ( $ webspaceKey , $ languageCode , $ segmentKey ) { return $ this -> sessionManager -> getRoutePath ( $ webspaceKey , $ languageCode , $ segmentKey ) ; }
Returns base path of routes from phpcr .
11,470
private function getPath ( $ relPath , $ webspaceKey , $ languageCode , $ segmentKey ) { $ basePath = $ this -> getWebspaceRouteNodeBasePath ( $ webspaceKey , $ languageCode , $ segmentKey ) ; return '/' . ltrim ( $ basePath , '/' ) . ( '' !== $ relPath ? '/' . ltrim ( $ relPath , '/' ) : '' ) ; }
Returns the abspath .
11,471
private function getResourceLocator ( $ path , $ webspaceKey , $ languageCode , $ segmentKey ) { $ basePath = $ this -> getWebspaceRouteNodeBasePath ( $ webspaceKey , $ languageCode , $ segmentKey ) ; if ( $ path === $ basePath ) { return '/' ; } if ( false !== strpos ( $ path , $ basePath . '/' ) ) { $ result = str_re...
Returns resource - locator .
11,472
public function handleMetadataLoad ( MetadataLoadEvent $ event ) { $ metadata = $ event -> getMetadata ( ) ; if ( false === $ metadata -> getReflectionClass ( ) -> isSubclassOf ( RobotBehavior :: class ) ) { return ; } $ metadata -> addFieldMapping ( 'noFollow' , [ 'encoding' => 'system' , 'property' => 'noFollow' , ] ...
Append mapping for robot fields .
11,473
private function convertPdfToImage ( $ resource ) { $ temporaryFilePath = $ this -> createTemporaryFile ( $ resource ) ; $ command = $ this -> ghostScriptPath . ' -dNOPAUSE -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -sOutputFile=' . $ temporaryFilePath . ' ' . '-dJPEGQ=100 -r300x300 -q ' . $ temporaryFilePath . ' -c quit...
Converts the first page of pdf to an image using ghostscript .
11,474
private function convertPsdToImage ( $ resource ) { $ temporaryFilePath = $ this -> createTemporaryFile ( $ resource ) ; try { $ image = $ this -> imagine -> open ( $ temporaryFilePath ) ; $ image = $ image -> layers ( ) [ 0 ] ; unlink ( $ temporaryFilePath ) ; return $ this -> createTemporaryResource ( $ image -> get ...
Converts a PSD to a png using imagine . Only works with Imagick and not with GD .
11,475
private function convertVideoToImage ( $ resource ) { $ temporaryFilePath = $ this -> createTemporaryFile ( $ resource ) ; $ this -> videoThumbnail -> generate ( $ temporaryFilePath , '00:00:02:01' , $ temporaryFilePath ) ; $ extractedImage = file_get_contents ( $ temporaryFilePath ) ; unlink ( $ temporaryFilePath ) ; ...
Converts one frame of a video to an image using FFMPEG .
11,476
private function createTemporaryResource ( string $ content ) { $ tempResource = fopen ( 'php://memory' , 'r+' ) ; fwrite ( $ tempResource , $ content ) ; rewind ( $ tempResource ) ; return $ tempResource ; }
Create temporary resource which will removed on fclose or end of process .
11,477
private function createTemporaryFile ( $ resource ) { $ path = tempnam ( sys_get_temp_dir ( ) , 'media' ) ; $ tempResource = fopen ( $ path , 'w' ) ; stream_copy_to_stream ( $ resource , $ tempResource ) ; return $ path ; }
Returns the path to a temporary file containing the given content .
11,478
private function doWrite ( NodeInterface $ node , PropertyInterface $ property , $ userId , $ webspaceKey , $ languageCode , $ segmentKey , $ isImport = false ) { if ( $ property -> getIsBlock ( ) ) { $ blockProperty = $ property ; while ( ! ( $ blockProperty instanceof BlockPropertyInterface ) ) { $ blockProperty = $ ...
Save the value from given property .
11,479
private function writeProperty ( PropertyInterface $ property , PropertyInterface $ blockProperty , $ value , $ index , NodeInterface $ node , $ userId , $ webspaceKey , $ languageCode , $ segmentKey , $ isImport = false ) { $ contentType = $ this -> contentTypeManager -> get ( $ property -> getContentTypeName ( ) ) ; ...
write a property to node .
11,480
private function configureMapManager ( $ config , ContainerBuilder $ container ) { $ mapManager = $ container -> getDefinition ( 'sulu_location.map_manager' ) ; foreach ( $ config [ 'enabled_providers' ] as $ enabledProviderName ) { $ providerConfig = $ config [ 'providers' ] [ $ enabledProviderName ] ; $ mapManager ->...
Configure the map manager - register the providers and geolocators with the map manager class .
11,481
private function configureGeolocators ( $ config , $ container ) { $ geolocatorName = $ config [ 'geolocator' ] ; $ container -> setParameter ( 'sulu_location.geolocator.name' , $ geolocatorName ) ; $ nominatim = function ( $ config , $ container ) { $ endpoint = $ config [ 'geolocators' ] [ 'nominatim' ] [ 'endpoint' ...
Configure the geolocator services .
11,482
protected function updateLastLogin ( $ user ) { if ( $ user instanceof BaseUser ) { $ user -> setLastLogin ( new \ DateTime ( ) ) ; $ this -> entityManager -> flush ( ) ; } }
Update the users last login .
11,483
public function handleCreate ( QueryCreateEvent $ event ) { $ innerQuery = $ event -> getInnerQuery ( ) ; if ( is_string ( $ innerQuery ) ) { $ phpcrQuery = $ this -> getQueryManager ( ) -> createQuery ( $ innerQuery , QueryInterface :: JCR_SQL2 ) ; } elseif ( $ innerQuery instanceof QueryInterface ) { $ phpcrQuery = $...
Create a new Sulu Query object .
11,484
public function handleQueryExecute ( QueryExecuteEvent $ event ) { $ query = $ event -> getQuery ( ) ; $ locale = $ query -> getLocale ( ) ; $ phpcrResult = $ query -> getPhpcrQuery ( ) -> execute ( ) ; $ event -> setResult ( new QueryResultCollection ( $ phpcrResult , $ this -> eventDispatcher , $ locale , $ event -> ...
Handle query execution .
11,485
private function addSorting ( $ qb , $ sorting , $ prefix = 'u' ) { foreach ( $ sorting as $ k => $ d ) { $ qb -> addOrderBy ( $ prefix . '.' . $ k , $ d ) ; } return $ qb ; }
Add sorting to querybuilder .
11,486
private function addPagination ( $ qb , $ offset , $ limit ) { $ qb -> setFirstResult ( $ offset ) ; $ qb -> setMaxResults ( $ limit ) ; return $ qb ; }
add pagination to querybuilder .
11,487
private function addWhere ( $ qb , $ where , $ prefix = '' ) { $ prefix = '' !== $ prefix ? $ prefix . '.' : '' ; $ and = $ qb -> expr ( ) -> andX ( ) ; foreach ( $ where as $ k => $ v ) { $ and -> add ( $ qb -> expr ( ) -> eq ( $ prefix . $ k , "'" . $ v . "'" ) ) ; } $ qb -> where ( $ and ) ; return $ qb ; }
add where to querybuilder .
11,488
private function getValue ( PropertyInterface $ property ) { $ default = [ 'presentAs' => null , 'items' => [ ] ] ; if ( ! is_array ( $ property -> getValue ( ) ) ) { return $ default ; } return array_merge ( $ default , $ property -> getValue ( ) ) ; }
Returns property - value merged with defaults .
11,489
public static function getUserClassName ( $ className ) { if ( null === self :: $ inflector ) { static :: $ inflector = new ProxyManagerClassNameInflector ( '' ) ; } return static :: $ inflector -> getUserClassName ( $ className ) ; }
Return the real class name if the given class name is a proxy class name .
11,490
public function cgetAction ( Request $ request ) { $ ids = array_filter ( explode ( ',' , $ request -> get ( 'ids' , '' ) ) ) ; $ result = $ this -> getCustomerManager ( ) -> findByIds ( $ ids ) ; $ list = new CollectionRepresentation ( $ result , self :: $ entityKey ) ; $ view = $ this -> view ( $ list , 200 ) ; retur...
Returns list of contacts and organizations .
11,491
public function addUrl ( Url $ url ) { $ this -> urls [ ] = $ url ; $ url -> setEnvironment ( $ this -> getType ( ) ) ; if ( $ url -> isMain ( ) || ! $ this -> mainUrl ) { $ this -> setMainUrl ( $ url ) ; } }
Adds a new url to this environment .
11,492
private function setMainUrl ( Url $ url ) { if ( null !== $ this -> mainUrl ) { $ this -> mainUrl -> setMain ( false ) ; } $ this -> mainUrl = $ url ; $ this -> mainUrl -> setMain ( true ) ; }
Sets the main url .
11,493
public function handleHydrate ( AbstractMappingEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ document ) ) { return ; } $ node = $ event -> getNode ( ) ; $ property = $ this -> getResourceSegmentProperty ( $ document ) ; if ( ! $ property ) { return ; } $ locale = $ this -> do...
Sets the ResourceSegment of the document .
11,494
public function handlePersistDocument ( PersistEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ document ) ) { return ; } $ property = $ this -> getResourceSegmentProperty ( $ document ) ; if ( $ property ) { $ this -> persistDocument ( $ document , $ property ) ; } }
Sets the ResourceSegment on the Structure .
11,495
public function handlePersistRoute ( PublishEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ document ) ) { return ; } if ( ! $ event -> getLocale ( ) ) { return ; } if ( $ document instanceof HomeDocument ) { return ; } if ( $ document instanceof RedirectTypeBehavior && Redirec...
Creates or updates the route for the document .
11,496
public function updateMovedDocument ( MoveEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof ResourceSegmentBehavior ) { return ; } $ webspaceKey = $ this -> documentInspector -> getWebspace ( $ event -> getDocument ( ) ) ; if ( ! $ webspaceKey ) { return ; } $ resourceLocatorStrat...
Moves the routes for all localizations of the document in the event .
11,497
public function updateCopiedDocument ( CopyEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof ResourceSegmentBehavior ) { return ; } $ this -> updateRoute ( $ this -> documentManager -> find ( $ event -> getCopiedPath ( ) , $ this -> documentInspector -> getLocale ( $ document ) ) ...
Copy the routes for all localization of the document in the event .
11,498
private function getResourceSegmentProperty ( $ document ) { $ structure = $ this -> documentInspector -> getStructureMetadata ( $ document ) ; if ( ! $ structure ) { return ; } $ property = $ structure -> getPropertyByTagName ( 'sulu.rlp' ) ; if ( ! $ property ) { throw new \ RuntimeException ( sprintf ( 'Structure "%...
Returns the property of the document s structure containing the ResourceSegment .
11,499
private function persistDocument ( ResourceSegmentBehavior $ document , PropertyMetadata $ property ) { $ document -> getStructure ( ) -> getProperty ( $ property -> getName ( ) ) -> setValue ( $ document -> getResourceSegment ( ) ) ; }
Sets the ResourceSegment to the given property of the given document .