idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
11,200
private function buildAudienceTargeting ( $ targetGroupId , $ locale ) { if ( ! $ targetGroupId ) { return ; } $ structure = $ this -> structureManager -> getStructure ( 'excerpt' ) ; $ property = new TranslatedProperty ( $ structure -> getProperty ( 'audience_targeting_groups' ) , $ locale , $ this -> languageNamespac...
Returns the where part for the audience targeting .
11,201
private function buildTagsWhere ( $ tags , $ operator , $ languageCode ) { $ structure = $ this -> structureManager -> getStructure ( 'excerpt' ) ; $ sql2Where = [ ] ; if ( $ structure -> hasProperty ( 'tags' ) ) { $ property = new TranslatedProperty ( $ structure -> getProperty ( 'tags' ) , $ languageCode , $ this -> ...
build tags where clauses .
11,202
private function buildCategoriesWhere ( $ categories , $ operator , $ languageCode ) { $ structure = $ this -> structureManager -> getStructure ( 'excerpt' ) ; $ sql2Where = [ ] ; if ( $ structure -> hasProperty ( 'categories' ) ) { $ property = new TranslatedProperty ( $ structure -> getProperty ( 'categories' ) , $ l...
build categories where clauses .
11,203
protected function buildPageSelector ( ) { $ idsWhere = [ ] ; foreach ( $ this -> ids as $ id ) { $ idsWhere [ ] = sprintf ( "page.[jcr:uuid] = '%s'" , $ id ) ; } return '(' . implode ( ' OR ' , $ idsWhere ) . ')' ; }
build select for uuids .
11,204
private function buildPageExclude ( ) { $ idsWhere = [ ] ; foreach ( $ this -> excluded as $ id ) { $ idsWhere [ ] = sprintf ( "(NOT page.[jcr:uuid] = '%s')" , $ id ) ; } return $ idsWhere ; }
build sql for exluded Pages .
11,205
public function onPostDeserialize ( ObjectEvent $ event ) { $ targetGroup = $ event -> getObject ( ) ; if ( ! $ targetGroup instanceof TargetGroupInterface ) { return ; } if ( $ targetGroup -> getWebspaces ( ) ) { foreach ( $ targetGroup -> getWebspaces ( ) as $ webspace ) { $ webspace -> setTargetGroup ( $ targetGroup...
Called after a target group was deserialized .
11,206
protected function handleCreatedExpressions ( array $ expressions , $ conjunction ) { $ expressionCounter = count ( $ expressions ) ; switch ( $ expressionCounter ) { case 0 : break ; case 1 : $ this -> listBuilder -> addExpression ( $ expressions [ 0 ] ) ; break ; default : $ conjunctionExpression = $ this -> createCo...
Handles the previouse created expressions and passes the over to the listbuilder .
11,207
protected function createConjunctionExpression ( array $ expressions , $ conjunction ) { if ( ListBuilderInterface :: CONJUNCTION_AND === strtoupper ( $ conjunction ) ) { return $ this -> listBuilder -> createAndExpression ( $ expressions ) ; } return $ this -> listBuilder -> createOrExpression ( $ expressions ) ; }
Creates a conjunction expression based on the given expressions and conjunction .
11,208
protected function createExpression ( Condition $ condition , $ fieldDescriptor ) { $ value = $ this -> getValue ( $ condition ) ; if ( 'between' === $ condition -> getOperator ( ) && DataTypes :: DATETIME_TYPE === $ condition -> getType ( ) ) { $ this -> expressions [ ] = $ this -> listBuilder -> createBetweenExpressi...
Creates expressions from conditions and add them to the expressions array .
11,209
protected function getValue ( Condition $ condition ) { $ value = $ condition -> getValue ( ) ; $ type = $ condition -> getType ( ) ; switch ( $ type ) { case DataTypes :: UNDEFINED_TYPE : case DataTypes :: STRING_TYPE : case DataTypes :: TAGS_TYPE : case DataTypes :: AUTO_COMPLETE_TYPE : return $ value ; case DataType...
Parses and returns the value of a condition .
11,210
public function findSettingValue ( $ roleId , $ key ) { $ queryBuilder = $ this -> createQueryBuilder ( 's' ) -> select ( 's.value' ) -> join ( 's.role' , 'r' ) -> where ( 'r.id = :roleId' ) -> andWhere ( 's.key = :key' ) -> setParameters ( [ 'roleId' => $ roleId , 'key' => $ key ] ) ; try { return json_decode ( $ quer...
Returns value of given role - setting .
11,211
public function findSetting ( $ roleId , $ key ) { $ queryBuilder = $ this -> createQueryBuilder ( 's' ) -> join ( 's.role' , 'r' ) -> where ( 'r.id = :roleId' ) -> andWhere ( 's.key = :key' ) -> setParameters ( [ 'roleId' => $ roleId , 'key' => $ key ] ) ; try { return $ queryBuilder -> getQuery ( ) -> getSingleResult...
Returns role - setting object .
11,212
public function get ( $ name ) { if ( ! isset ( $ this -> geolocators [ $ name ] ) ) { throw new GeolocatorNotFoundException ( sprintf ( 'Attempt to retrieve unknown geolocator "%s"' , $ name ) ) ; } return $ this -> container -> get ( $ this -> geolocators [ $ name ] ) ; }
Retrieve the named name .
11,213
public function cgetAction ( Request $ request ) { $ serializationGroups = [ ] ; $ locale = $ this -> getLocale ( $ request ) ; if ( 'true' == $ request -> get ( 'flat' ) ) { $ list = $ this -> getList ( $ request , $ locale ) ; } else { if ( true == $ request -> get ( 'bySystem' ) ) { $ contacts = $ this -> getContact...
lists all contacts optional parameter flat calls listAction .
11,214
private function getList ( Request $ request , $ locale ) { $ restHelper = $ this -> getRestHelper ( ) ; $ factory = $ this -> get ( 'sulu_core.doctrine_list_builder_factory' ) ; $ listBuilder = $ factory -> create ( $ this -> container -> getParameter ( 'sulu.model.contact.class' ) ) ; $ restHelper -> initializeListBu...
Returns list for cget .
11,215
private function prepareListResponse ( DoctrineListBuilder $ listBuilder , $ locale ) { $ listResponse = $ listBuilder -> execute ( ) ; $ listResponse = $ this -> addAvatars ( $ listResponse , $ locale ) ; $ ids = $ listBuilder -> getIds ( ) ; if ( null !== $ ids ) { $ comparator = $ this -> getComparator ( ) ; @ usort...
Prepare list response .
11,216
public function deleteAction ( $ id ) { try { $ deleteCallback = $ this -> getContactManager ( ) -> delete ( ) ; $ view = $ this -> responseDelete ( $ id , $ deleteCallback ) ; } catch ( EntityNotFoundException $ e ) { $ view = $ this -> view ( $ e -> toArray ( ) , 404 ) ; } return $ this -> handleView ( $ view ) ; }
Deletes a Contact with the given ID from database .
11,217
public function getAction ( $ id ) { $ contactManager = $ this -> getContactManager ( ) ; $ locale = $ this -> getUser ( ) -> getLocale ( ) ; try { $ view = $ this -> responseGetById ( $ id , function ( $ id ) use ( $ contactManager , $ locale ) { return $ contactManager -> getById ( $ id , $ locale ) ; } ) ; $ context...
Shows the contact with the given Id .
11,218
public function postAction ( Request $ request ) { try { $ this -> checkArguments ( $ request ) ; $ contact = $ this -> getContactManager ( ) -> save ( $ request -> request -> all ( ) ) ; $ apiContact = $ this -> getContactManager ( ) -> getContact ( $ contact , $ this -> getLocale ( $ request ) ) ; $ view = $ this -> ...
Creates a new contact .
11,219
protected function getContactsByUserSystem ( ) { $ repo = $ this -> get ( 'sulu_security.user_repository' ) ; $ users = $ repo -> findUserBySystem ( $ this -> getParameter ( 'sulu_security.system' ) ) ; $ contacts = [ ] ; foreach ( $ users as $ user ) { $ contacts [ ] = $ user -> getContact ( ) ; } return $ contacts ; ...
Returns a list of contacts which have a user in the sulu system .
11,220
private function addAvatars ( $ contacts , $ locale ) { $ ids = array_filter ( array_column ( $ contacts , 'avatar' ) ) ; $ avatars = $ this -> get ( 'sulu_media.media_manager' ) -> getFormatUrls ( $ ids , $ locale ) ; foreach ( $ contacts as $ key => $ contact ) { if ( array_key_exists ( 'avatar' , $ contact ) && $ co...
Takes an array of contacts and resets the avatar containing the media id with the actual urls to the avatars thumbnail .
11,221
protected function filterNullValues ( array $ values ) { $ result = array_filter ( $ values , function ( $ val ) { return $ val || 0 === $ val || false === $ val ; } ) ; return $ result ; }
Returns a new array without null values .
11,222
private function setTargetGroupHeader ( Request $ request , CacheInvalidation $ kernel ) { $ hadValidTargetGroup = true ; $ visitorTargetGroup = $ request -> cookies -> get ( static :: TARGET_GROUP_COOKIE ) ; $ visitorSession = $ request -> cookies -> get ( static :: VISITOR_SESSION_COOKIE ) ; if ( null === $ visitorTa...
Sets the target group header based on an existing cookie so that the application can adapt the content according to it . If the cookie didn t exist yet another request is fired in order to set the value for the cookie .
11,223
private function requestTargetGroup ( Request $ request , CacheInvalidation $ kernel , int $ currentTargetGroup = null ) { $ targetGroupRequest = Request :: create ( static :: TARGET_GROUP_URL , Request :: METHOD_GET , [ ] , [ ] , [ ] , $ request -> server -> all ( ) ) ; if ( $ currentTargetGroup ) { $ targetGroupReque...
Sends a request to the application to determine the target group of the current visitor .
11,224
private function setTargetGroupCookie ( Response $ response , Request $ request ) { $ response -> headers -> setCookie ( new Cookie ( static :: TARGET_GROUP_COOKIE , $ request -> headers -> get ( static :: TARGET_GROUP_HEADER ) , static :: TARGET_GROUP_COOKIE_LIFETIME ) ) ; $ response -> headers -> setCookie ( new Cook...
Set the cookie for the target group from the request . Should only be set in case the cookie was not set before .
11,225
public function getAvailableLocalization ( StructureBehavior $ document , $ locale ) { $ availableLocales = $ this -> inspector -> getLocales ( $ document ) ; if ( in_array ( $ locale , $ availableLocales ) ) { return $ locale ; } $ fallbackLocale = null ; if ( $ document instanceof WebspaceBehavior ) { $ fallbackLocal...
Return available localizations .
11,226
public function loadClassMetadata ( LoadClassMetadataEventArgs $ event ) { $ metadata = $ event -> getClassMetadata ( ) ; $ reflection = $ metadata -> getReflectionClass ( ) ; if ( null !== $ reflection && $ reflection -> implementsInterface ( 'Sulu\Component\Persistence\Model\UserBlameInterface' ) ) { if ( ! $ metadat...
Map creator and changer fields to User objects .
11,227
private function sortTeasers ( array $ teasers , array $ result , array $ positions , array $ items ) { foreach ( $ teasers as $ teaser ) { $ index = $ positions [ sprintf ( '%s;%s' , $ teaser -> getType ( ) , $ teaser -> getId ( ) ) ] ; $ result [ $ index ] = $ teaser ; $ item = $ items [ $ index ] ; if ( [ 'type' , '...
Returns sorted teaser by given position array .
11,228
private function sortItems ( $ items ) { $ ids = [ ] ; $ positions = [ ] ; $ index = 0 ; foreach ( $ items as $ item ) { if ( ! array_key_exists ( $ item [ 'type' ] , $ ids ) ) { $ ids [ $ item [ 'type' ] ] = [ ] ; } $ ids [ $ item [ 'type' ] ] [ ] = $ item [ 'id' ] ; $ positions [ sprintf ( '%s;%s' , $ item [ 'type' ]...
Returns items sorted by type .
11,229
public function getChild ( $ name ) { if ( ! isset ( $ this -> children [ $ name ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Unknown child "%s" in structure "%s" loaded from: "%s". Children: "%s"' , $ name , $ this -> name , $ this -> resource , implode ( '", "' , array_keys ( $ this -> children ) ) ) ) ;...
Return the named property .
11,230
public function addChild ( self $ child ) { if ( isset ( $ this -> children [ $ child -> name ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Child with key "%s" already exists' , $ child -> name ) ) ; } $ this -> children [ $ child -> name ] = $ child ; }
Adds a child item .
11,231
public function getParameter ( $ name ) { if ( ! isset ( $ this -> parameters [ $ name ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Unknown parameter "%s", known parameters: "%s"' , $ name , implode ( '", "' , array_keys ( $ this -> parameters ) ) ) ) ; } return $ this -> parameters [ $ name ] ; }
Return the paramter with the given name .
11,232
public function getTag ( $ tagName ) { foreach ( $ this -> tags as $ tag ) { if ( $ tag [ 'name' ] === $ tagName ) { return $ tag ; } } throw new \ InvalidArgumentException ( sprintf ( 'Unknown tag "%s"' , $ tagName ) ) ; }
Return the named tag .
11,233
public function handlePersist ( PersistEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ document ) || ! $ document -> getPermissions ( ) ) { return ; } $ node = $ event -> getNode ( ) ; foreach ( $ document -> getPermissions ( ) as $ roleId => $ permission ) { $ node -> setPrope...
Adds the security information to the node .
11,234
public function handleHydrate ( HydrateEvent $ event ) { $ document = $ event -> getDocument ( ) ; $ node = $ event -> getNode ( ) ; if ( ! $ this -> supports ( $ document ) ) { return ; } $ permissions = [ ] ; foreach ( $ node -> getProperties ( 'sec:*' ) as $ property ) { $ roleId = substr ( $ property -> getName ( )...
Adds the security information to the hydrated object .
11,235
private function getAllowedPermissions ( $ permissions ) { $ allowedPermissions = [ ] ; foreach ( $ permissions as $ permission => $ allowed ) { if ( $ allowed ) { $ allowedPermissions [ ] = $ permission ; } } return $ allowedPermissions ; }
Extracts the keys of the allowed permissions into an own array .
11,236
private function createNode ( NodeInterface $ node , $ pathSegment , $ uuid ) { if ( $ node -> hasNode ( $ pathSegment ) ) { return $ node -> getNode ( $ pathSegment ) ; } $ node = $ node -> addNode ( $ pathSegment ) ; $ node -> addMixin ( 'mix:referenceable' ) ; $ node -> setProperty ( 'jcr:uuid' , $ uuid ) ; return $...
Adds a node with the given path segment as a node name to the given node .
11,237
public function cgetAction ( Request $ request , $ webspace ) { $ entities = $ this -> get ( 'sulu_website.analytics.manager' ) -> findAll ( $ webspace ) ; $ list = new RouteAwareRepresentation ( new CollectionRepresentation ( $ entities , self :: RESULT_KEY ) , 'cget_webspace_analytics' , array_merge ( $ request -> re...
Returns webspace analytics by webspace key .
11,238
public function getAction ( $ webspace , $ id ) { $ entity = $ this -> get ( 'sulu_website.analytics.manager' ) -> find ( $ id ) ; return $ this -> handleView ( $ this -> view ( $ entity , 200 ) ) ; }
Returns a single analytics by id .
11,239
public function postAction ( Request $ request , $ webspace ) { $ data = $ request -> request -> all ( ) ; $ data [ 'content' ] = $ this -> buildContent ( $ data ) ; $ entity = $ this -> get ( 'sulu_website.analytics.manager' ) -> create ( $ webspace , $ data ) ; $ this -> get ( 'doctrine.orm.entity_manager' ) -> flush...
Creates a analytics for given webspace .
11,240
public function putAction ( Request $ request , $ webspace , $ id ) { $ data = $ request -> request -> all ( ) ; $ data [ 'content' ] = $ this -> buildContent ( $ data ) ; $ entity = $ this -> get ( 'sulu_website.analytics.manager' ) -> update ( $ id , $ data ) ; $ this -> get ( 'doctrine.orm.entity_manager' ) -> flush...
Updates analytics with given id .
11,241
public function deleteAction ( $ webspace , $ id ) { $ this -> get ( 'sulu_website.analytics.manager' ) -> remove ( $ id ) ; $ this -> get ( 'doctrine.orm.entity_manager' ) -> flush ( ) ; $ this -> get ( 'sulu_website.http_cache.clearer' ) -> clear ( ) ; return $ this -> handleView ( $ this -> view ( null , 204 ) ) ; }
Removes given analytics .
11,242
public function cdeleteAction ( Request $ request , $ webspace ) { $ ids = array_filter ( explode ( ',' , $ request -> get ( 'ids' , '' ) ) ) ; $ this -> get ( 'sulu_website.analytics.manager' ) -> removeMultiple ( $ ids ) ; $ this -> get ( 'doctrine.orm.entity_manager' ) -> flush ( ) ; $ this -> get ( 'sulu_website.ht...
Removes a list of analytics .
11,243
protected function getTypeForString ( $ type ) { switch ( $ type ) { case 'string' : return DataTypes :: STRING_TYPE ; case 'number' : return DataTypes :: NUMBER_TYPE ; case 'date' : case 'datetime' : return DataTypes :: DATETIME_TYPE ; case 'boolean' : return DataTypes :: BOOLEAN_TYPE ; case 'tags' : return DataTypes ...
Returns integer for string type .
11,244
public function slugify ( $ text ) { $ text = $ this -> slugifier -> slugify ( $ text ) ; $ text = preg_replace ( '((\d+)([eE]))' , '$1-$2' , $ text ) ; return $ text ; }
Slugifies given string to a valid node - name .
11,245
public function getAction ( $ id ) { $ view = $ this -> responseGetById ( $ id , function ( $ id ) { return $ this -> getManager ( ) -> findById ( $ id ) ; } ) ; $ context = new Context ( ) ; $ context -> setGroups ( [ 'partialTag' ] ) ; $ view -> setContext ( $ context ) ; return $ this -> handleView ( $ view ) ; }
Returns a single tag with the given id .
11,246
public function cgetAction ( Request $ request ) { if ( 'true' == $ request -> get ( 'flat' ) ) { $ restHelper = $ this -> get ( 'sulu_core.doctrine_rest_helper' ) ; $ factory = $ this -> get ( 'sulu_core.doctrine_list_builder_factory' ) ; $ tagEntityName = $ this -> getParameter ( 'sulu.model.tag.class' ) ; $ fieldDes...
returns all tags .
11,247
public function postAction ( Request $ request ) { $ name = $ request -> get ( 'name' ) ; try { if ( null == $ name ) { throw new MissingArgumentException ( self :: $ entityName , 'name' ) ; } $ tag = $ this -> getManager ( ) -> save ( $ this -> getData ( $ request ) ) ; $ context = new Context ( ) ; $ context -> setGr...
Inserts a new tag .
11,248
public function deleteAction ( $ id ) { $ delete = function ( $ id ) { try { $ this -> getManager ( ) -> delete ( $ id ) ; } catch ( TagNotFoundException $ tnfe ) { throw new EntityNotFoundException ( self :: $ entityName , $ id ) ; } } ; $ view = $ this -> responseDelete ( $ id , $ delete ) ; return $ this -> handleVi...
Deletes the tag with the given ID .
11,249
public function postMergeAction ( Request $ request ) { try { $ srcTagIds = explode ( ',' , $ request -> get ( 'src' ) ) ; $ destTagId = $ request -> get ( 'dest' ) ; $ destTag = $ this -> getManager ( ) -> merge ( $ srcTagIds , $ destTagId ) ; $ view = $ this -> view ( null , 303 , [ 'location' => $ this -> get ( 'rou...
POST Route annotation .
11,250
private function addStructureProperties ( StructureMetadata $ structureMetadata , StructureBehavior $ document , VisitorInterface $ visitor ) { $ structure = $ document -> getStructure ( ) ; $ data = $ structure -> toArray ( ) ; foreach ( $ structureMetadata -> getProperties ( ) as $ name => $ property ) { if ( 'title'...
Adds the properties of the structure to the serialization .
11,251
private function addBreadcrumb ( StructureBehavior $ document , VisitorInterface $ visitor ) { $ items = [ ] ; $ parentDocument = $ this -> inspector -> getParent ( $ document ) ; while ( $ parentDocument instanceof StructureBehavior ) { $ item = [ ] ; if ( $ parentDocument instanceof UuidBehavior ) { $ item [ 'uuid' ]...
Adds the breadcrumb to the serialization .
11,252
private function upgradeNode ( NodeInterface $ node ) { foreach ( $ node -> getProperties ( 'i18n:-*' ) as $ property ) { $ property -> remove ( ) ; } foreach ( $ node -> getNodes ( ) as $ childNode ) { $ this -> upgradeNode ( $ childNode ) ; } }
Removes non translated properties .
11,253
public function getMetadataForObject ( $ object ) { if ( ! $ object instanceof StructureBehavior ) { return ; } $ documentMetadata = $ this -> metadataFactory -> getMetadataForClass ( get_class ( $ object ) ) ; $ structure = $ this -> structureFactory -> getStructureMetadata ( $ documentMetadata -> getAlias ( ) , $ obj...
loads metadata for a given class if its derived from StructureInterface .
11,254
private function findRouteByPath ( $ path , $ locale ) { $ path = '/' . ltrim ( $ path , '/' ) ; if ( ! array_key_exists ( $ path , $ this -> routeCache ) ) { $ this -> routeCache [ $ path ] = $ this -> routeRepository -> findByPath ( $ path , $ locale ) ; } return $ this -> routeCache [ $ path ] ; }
Find route and cache it .
11,255
protected function createRoute ( RouteInterface $ route , Request $ request ) { $ routePath = $ this -> decodePathInfo ( $ request -> getPathInfo ( ) ) ; if ( $ route -> isHistory ( ) ) { return new Route ( $ routePath , [ '_controller' => 'SuluWebsiteBundle:Redirect:redirect' , 'url' => $ request -> getSchemeAndHttpHo...
Will create a symfony route .
11,256
private function stripFormatExtension ( $ path , $ format ) { $ extension = '.' . $ format ; if ( substr ( $ path , - strlen ( $ extension ) ) === $ extension ) { $ path = substr ( $ path , 0 , strlen ( $ path ) - strlen ( $ extension ) ) ; } return $ path ; }
Return the given path without the format extension .
11,257
public function getCategoriesFunction ( $ locale , $ parentKey = null ) { return $ this -> memoizeCache -> memoizeById ( 'sulu_categories' , func_get_args ( ) , function ( $ locale , $ parentKey = null ) { $ entities = $ this -> categoryManager -> findChildrenByParentKey ( $ parentKey ) ; $ categories = $ this -> categ...
Returns an array of serialized categories . If parentKey is set only the children of the category which is assigned to the given key are returned .
11,258
private function findDateProperties ( StructureMetadata $ structureMetadata , array & $ properties ) { $ structureName = $ structureMetadata -> getName ( ) ; foreach ( $ structureMetadata -> getProperties ( ) as $ property ) { if ( 'date' === $ property -> getType ( ) ) { $ properties [ $ structureName ] [ ] = [ 'prope...
Returns all properties which are a date field .
11,259
private function findDateBlockProperties ( BlockMetadata $ property , $ structureName , array & $ properties ) { $ result = [ 'property' => $ property , 'components' => [ ] ] ; foreach ( $ property -> getComponents ( ) as $ component ) { $ componentResult = [ 'component' => $ component , 'children' => [ ] ] ; foreach (...
Adds the block property to the list if it contains a date field .
11,260
private function iterateStructureNodes ( StructureMetadata $ structureMetadata , array $ properties , $ up ) { foreach ( $ this -> localizationManager -> getLocalizations ( ) as $ localization ) { $ rows = $ this -> session -> getWorkspace ( ) -> getQueryManager ( ) -> createQuery ( sprintf ( 'SELECT * FROM [nt:unstruc...
Iterates over all nodes of the given type and upgrades them .
11,261
private function upgradeBlockProperty ( BlockMetadata $ blockProperty , array $ components , NodeInterface $ node , $ locale , $ up ) { $ componentNames = array_map ( function ( $ item ) { return $ item [ 'component' ] -> getName ( ) ; } , $ components ) ; $ lengthName = sprintf ( 'i18n:%s-%s-length' , $ locale , $ blo...
Upgrades the given block property to the new date representation .
11,262
private function upgradeProperty ( PropertyMetadata $ property , NodeInterface $ node , $ locale , $ up ) { $ name = sprintf ( 'i18n:%s-%s' , $ locale , $ property -> getName ( ) ) ; if ( ! $ node -> hasProperty ( $ name ) ) { return ; } $ value = $ node -> getPropertyValue ( $ name ) ; if ( $ up ) { $ value = $ this -...
Upgrades the given property to the new date representation .
11,263
private function upgradeDate ( & $ value ) { if ( $ value instanceof \ DateTime ) { return $ value ; } $ value = \ DateTime :: createFromFormat ( 'Y-m-d' , $ value ) ; return $ value ; }
Upgrades the given date to the new representation .
11,264
public function setOperatorValue ( \ Sulu \ Bundle \ ResourceBundle \ Entity \ OperatorValue $ operatorValue ) { $ this -> operatorValue = $ operatorValue ; return $ this ; }
Set operatorValue .
11,265
private function applyTransformations ( ImageInterface $ image , $ tansformations ) { foreach ( $ tansformations as $ transformation ) { if ( ! isset ( $ transformation [ 'effect' ] ) ) { throw new ImageProxyInvalidFormatOptionsException ( 'Effect not found' ) ; } $ image = $ this -> modifyAllLayers ( $ image , functio...
Applies an array of transformations on a passed image .
11,266
private function applyFormatCrop ( ImageInterface $ image , array $ cropParameters ) { return $ this -> modifyAllLayers ( $ image , function ( ImageInterface $ layer ) use ( $ cropParameters ) { return $ this -> cropper -> crop ( $ layer , $ cropParameters [ 'x' ] , $ cropParameters [ 'y' ] , $ cropParameters [ 'width'...
Crops a given image according to given parameters .
11,267
private function applyFocus ( ImageInterface $ image , FileVersion $ fileVersion , array $ scale ) { return $ this -> modifyAllLayers ( $ image , function ( ImageInterface $ layer ) use ( $ fileVersion , $ scale ) { return $ this -> focus -> focus ( $ layer , $ fileVersion -> getFocusPointX ( ) , $ fileVersion -> getFo...
Crops the given image according to the focus point defined in the file version .
11,268
private function applyScale ( ImageInterface $ image , $ scale ) { return $ this -> modifyAllLayers ( $ image , function ( ImageInterface $ layer ) use ( $ scale ) { return $ this -> scaler -> scale ( $ layer , $ scale [ 'x' ] , $ scale [ 'y' ] , $ scale [ 'mode' ] , $ scale [ 'forceRatio' ] , $ scale [ 'retina' ] ) ; ...
Scales a given image according to the information passed as the second argument .
11,269
private function toRGB ( ImageInterface $ image ) { if ( 'cmyk' == $ image -> palette ( ) -> name ( ) ) { $ image -> usePalette ( new RGB ( ) ) ; } return $ image ; }
Ensures that the color mode of the passed image is RGB .
11,270
private function getCropParameters ( ImageInterface $ image , $ formatOptions , array $ format ) { if ( isset ( $ formatOptions ) ) { $ parameters = [ 'x' => $ formatOptions -> getCropX ( ) , 'y' => $ formatOptions -> getCropY ( ) , 'width' => $ formatOptions -> getCropWidth ( ) , 'height' => $ formatOptions -> getCrop...
Constructs the parameters for the cropper . Returns null when the image should not be cropped .
11,271
private function modifyAllLayers ( ImageInterface $ image , callable $ modifier ) { if ( count ( $ image -> layers ( ) ) ) { $ countLayer = 0 ; $ image -> layers ( ) -> coalesce ( ) ; $ temporaryImage = null ; foreach ( $ image -> layers ( ) as $ layer ) { ++ $ countLayer ; $ layer = call_user_func ( $ modifier , $ lay...
Applies a callback to every layer of an image and returns the resulting image .
11,272
private function getFormat ( $ formatKey ) { if ( ! isset ( $ this -> formats [ $ formatKey ] ) ) { throw new ImageProxyInvalidImageFormat ( 'Format was not found' ) ; } return $ this -> formats [ $ formatKey ] ; }
Return the options for the given format .
11,273
public function findByWebspaceKey ( $ webspaceKey ) { $ queryBuilder = $ this -> createQueryBuilder ( 'a' ) -> addSelect ( 'domains' ) -> leftJoin ( 'a.domains' , 'domains' ) -> where ( 'a.webspaceKey = :webspaceKey' ) -> andWhere ( 'a.allDomains = TRUE OR domains.environment = :environment' ) -> orderBy ( 'a.id' , 'AS...
Returns list of analytics filterd by webspace key and environment .
11,274
public function findById ( $ id ) { $ queryBuilder = $ this -> createQueryBuilder ( 'a' ) -> addSelect ( 'domains' ) -> leftJoin ( 'a.domains' , 'domains' ) -> where ( 'a.id = :id' ) ; $ query = $ queryBuilder -> getQuery ( ) ; $ query -> setParameter ( 'id' , $ id ) ; return $ query -> getSingleResult ( ) ; }
Returns analytics by id .
11,275
public function onPostSerialize ( ObjectEvent $ event ) { $ document = $ event -> getObject ( ) ; if ( ! $ document instanceof WorkflowStageBehavior ) { return ; } $ visitor = $ event -> getVisitor ( ) ; $ visitor -> addData ( 'publishedState' , WorkflowStage :: PUBLISHED === $ document -> getWorkflowStage ( ) ) ; }
Adds the published state to the serialization .
11,276
public function merge ( array $ item ) { $ this -> title = $ this -> getValue ( 'title' , $ item , $ this -> getTitle ( ) ) ; $ this -> description = $ this -> getValue ( 'description' , $ item , $ this -> getDescription ( ) ) ; $ this -> moreText = $ this -> getValue ( 'moreText' , $ item , $ this -> getMoreText ( ) )...
Merges given data with this teaser .
11,277
public function onPostSerialize ( ObjectEvent $ event ) { $ content = $ event -> getObject ( ) ; $ visitor = $ event -> getVisitor ( ) ; if ( ! ( $ content instanceof Content ) ) { return ; } foreach ( $ content -> getData ( ) as $ key => $ value ) { $ visitor -> setData ( $ key , $ value ) ; } $ visitor -> setData ( '...
Add data for serialization of content objects .
11,278
private function parse ( $ locale ) { $ parts = explode ( '_' , $ locale ) ; $ localization = new Localization ( ) ; $ localization -> setLanguage ( $ parts [ 0 ] ) ; if ( count ( $ parts ) > 1 ) { $ localization -> setCountry ( $ parts [ 1 ] ) ; } return $ localization ; }
Converts locale string to localization object .
11,279
private function generateTreeByPath ( array $ contents , $ uuid ) { $ childrenByPath = [ ] ; foreach ( $ contents as $ content ) { $ path = PathHelper :: getParentPath ( $ content -> getPath ( ) ) ; if ( ! isset ( $ childrenByPath [ $ path ] ) ) { $ childrenByPath [ $ path ] = [ ] ; } $ order = $ content [ 'order' ] ; ...
Generates a content - tree with paths of given content array .
11,280
private function resolvePathByUuid ( $ uuid ) { $ queryBuilder = new QueryBuilder ( $ this -> qomFactory ) ; $ queryBuilder -> select ( 'node' , 'jcr:uuid' , 'uuid' ) -> from ( $ this -> qomFactory -> selector ( 'node' , 'nt:unstructured' ) ) -> where ( $ this -> qomFactory -> comparison ( $ this -> qomFactory -> prope...
Resolve path for node with given uuid .
11,281
private function resolveQueryBuilder ( QueryBuilder $ queryBuilder , $ locale , $ locales , MappingInterface $ mapping , UserInterface $ user = null ) { return array_values ( array_filter ( array_map ( function ( Row $ row ) use ( $ mapping , $ locale , $ locales , $ user ) { return $ this -> resolveContent ( $ row , $...
Resolves query results to content .
11,282
private function getQueryBuilder ( $ locale , $ locales , UserInterface $ user = null ) { $ queryBuilder = new QueryBuilder ( $ this -> qomFactory ) ; $ queryBuilder -> select ( 'node' , 'jcr:uuid' , 'uuid' ) -> addSelect ( 'node' , $ this -> getPropertyName ( 'nodeType' , $ locale ) , 'nodeType' ) -> addSelect ( 'node...
Returns QueryBuilder with basic select and where statements .
11,283
private function getLocalesByWebspaceKey ( $ webspaceKey ) { $ webspace = $ this -> webspaceManager -> findWebspaceByKey ( $ webspaceKey ) ; return array_map ( function ( Localization $ localization ) { return $ localization -> getLocale ( ) ; } , $ webspace -> getAllLocalizations ( ) ) ; }
Returns array of locales for given webspace key .
11,284
private function getLocalesByPortalKey ( $ portalKey ) { $ portal = $ this -> webspaceManager -> findPortalByKey ( $ portalKey ) ; return array_map ( function ( Localization $ localization ) { return $ localization -> getLocale ( ) ; } , $ portal -> getLocalizations ( ) ) ; }
Returns array of locales for given portal key .
11,285
private function appendMapping ( QueryBuilder $ queryBuilder , MappingInterface $ mapping , $ locale , $ locales ) { if ( $ mapping -> onlyPublished ( ) ) { $ queryBuilder -> andWhere ( $ this -> qomFactory -> comparison ( $ this -> qomFactory -> propertyValue ( 'node' , $ this -> propertyEncoder -> localizedSystemName...
Append mapping selects to given query - builder .
11,286
private function appendSingleMapping ( QueryBuilder $ queryBuilder , $ propertyName , $ locales ) { foreach ( $ locales as $ locale ) { $ alias = sprintf ( '%s%s' , $ locale , str_replace ( '-' , '_' , ucfirst ( $ propertyName ) ) ) ; $ queryBuilder -> addSelect ( 'node' , $ this -> propertyEncoder -> localizedContentN...
Append mapping selects for a single property to given query - builder .
11,287
private function appendUrlMapping ( QueryBuilder $ queryBuilder , $ locales ) { $ structures = $ this -> structureManager -> getStructures ( Structure :: TYPE_PAGE ) ; $ urlNames = [ ] ; foreach ( $ structures as $ structure ) { if ( ! $ structure -> hasTag ( 'sulu.rlp' ) ) { continue ; } $ propertyName = $ structure -...
Append mapping for url to given query - builder .
11,288
private function resolveAvailableLocales ( Row $ row ) { $ locales = [ ] ; foreach ( $ row -> getValues ( ) as $ key => $ value ) { if ( preg_match ( '/^node.([a-zA-Z_]*?)Template/' , $ key , $ matches ) && '' !== $ value && ! $ row -> getValue ( sprintf ( 'node.%sShadow_on' , $ matches [ 1 ] ) ) ) { $ locales [ ] = $ ...
Resolves all available localizations for given row .
11,289
public function resolveInternalLinkContent ( Row $ row , $ locale , $ webspaceKey , MappingInterface $ mapping , StructureType $ type = null , UserInterface $ user = null ) { $ linkedContent = $ this -> find ( $ row -> getValue ( 'internalLink' ) , $ locale , $ webspaceKey , $ mapping ) ; $ data = $ linkedContent -> ge...
Resolve a single result row which is an internal link to a content object .
11,290
private function resolveProperty ( Row $ row , $ name , $ locale , $ shadowLocale = null ) { if ( array_key_exists ( sprintf ( 'node.%s' , $ name ) , $ row -> getValues ( ) ) ) { return $ row -> getValue ( $ name ) ; } if ( null !== $ shadowLocale && ! in_array ( $ name , self :: $ nonFallbackProperties ) ) { $ locale ...
Resolve a property and follow shadow locale if it has one .
11,291
private function resolveUrl ( Row $ row , $ locale ) { if ( WorkflowStage :: PUBLISHED !== $ this -> resolveProperty ( $ row , $ locale . 'State' , $ locale ) ) { return ; } $ template = $ this -> resolveProperty ( $ row , 'template' , $ locale ) ; if ( empty ( $ template ) ) { return ; } $ structure = $ this -> struct...
Resolve url property .
11,292
private function resolvePath ( Row $ row , $ webspaceKey ) { return '/' . ltrim ( str_replace ( $ this -> sessionManager -> getContentPath ( $ webspaceKey ) , '' , $ row -> getPath ( ) ) , '/' ) ; }
Resolves path for given row .
11,293
private function resolvePermissions ( Row $ row , UserInterface $ user = null ) { $ permissions = [ ] ; if ( null !== $ user ) { foreach ( $ user -> getRoleObjects ( ) as $ role ) { foreach ( array_filter ( explode ( ' ' , $ row -> getValue ( sprintf ( 'role%s' , $ role -> getId ( ) ) ) ) ) as $ permission ) { $ permis...
Resolves permissions for given user .
11,294
private function resolveHasChildren ( Row $ row ) { $ queryBuilder = new QueryBuilder ( $ this -> qomFactory ) ; $ queryBuilder -> select ( 'node' , 'jcr:uuid' , 'uuid' ) -> from ( $ this -> qomFactory -> selector ( 'node' , 'nt:unstructured' ) ) -> where ( $ this -> qomFactory -> childNode ( 'node' , $ row -> getPath ...
Resolve property has - children with given node .
11,295
public function onPostSerialize ( ObjectEvent $ event ) { $ document = $ event -> getObject ( ) ; if ( ! $ document instanceof ShadowLocaleBehavior || ! $ this -> documentRegistry -> hasDocument ( $ document ) ) { return ; } $ visitor = $ event -> getVisitor ( ) ; $ visitor -> addData ( 'shadowLocales' , $ this -> docu...
Adds the enabled shadow languages to the serialization .
11,296
protected function loadStructures ( $ webspaceKey ) { $ structures = [ ] ; $ keys = [ ] ; foreach ( $ this -> structureManager -> getStructures ( ) as $ page ) { $ template = sprintf ( '%s.html.twig' , $ page -> getView ( ) ) ; if ( $ this -> templateExists ( $ template ) ) { $ keys [ ] = $ page -> getKey ( ) ; $ struc...
Returns and caches structures for given webspace .
11,297
protected function templateExists ( $ template ) { $ loader = $ this -> twig -> getLoader ( ) ; if ( method_exists ( $ loader , 'exists' ) ) { return $ loader -> exists ( $ template ) ; } try { $ loader -> getSource ( $ template ) -> getCode ( ) ; } catch ( \ Twig_Error_Loader $ e ) { return false ; } return true ; }
checks if a template with given name exists .
11,298
public static function truncate ( $ text , $ length , $ suffix = '...' ) { $ strlen = mb_strlen ( $ text , 'UTF-8' ) ; if ( $ strlen > $ length ) { $ truncatedLength = $ length - strlen ( $ suffix ) ; $ text = mb_substr ( $ text , 0 , $ truncatedLength , 'UTF-8' ) . $ suffix ; } return $ text ; }
UTF - 8 safe text truncation .
11,299
protected function findIdsByGivenCriteria ( ) { $ select = $ this -> getSelectAs ( $ this -> idField ) ; $ subQueryBuilder = $ this -> createSubQueryBuilder ( $ select ) ; if ( null != $ this -> limit ) { $ subQueryBuilder -> setMaxResults ( $ this -> limit ) -> setFirstResult ( $ this -> limit * ( $ this -> page - 1 )...
Function that finds all IDs of entities that match the search criteria .