idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
11,500 | private function persistRoute ( ResourceSegmentBehavior $ document ) { $ resourceLocatorStrategy = $ this -> resourceLocatorStrategyPool -> getStrategyByWebspaceKey ( $ this -> documentInspector -> getWebspace ( $ document ) ) ; $ resourceLocatorStrategy -> save ( $ document , null ) ; } | Creates or updates the route of the document using the RlpStrategy . |
11,501 | private function updateRoute ( $ document , $ generateRoutes ) { $ locales = $ this -> documentInspector -> getLocales ( $ document ) ; $ webspaceKey = $ this -> documentInspector -> getWebspace ( $ document ) ; $ uuid = $ this -> documentInspector -> getUuid ( $ document ) ; $ path = $ this -> documentInspector -> get... | Updates the route for the given document after a move or copy . |
11,502 | private function updateResourceSegmentProperty ( NodeInterface $ node , $ resourceSegmentPropertyName , $ parentUuid , $ webspaceKey , $ locale ) { $ resourceLocatorStrategy = $ this -> resourceLocatorStrategyPool -> getStrategyByWebspaceKey ( $ webspaceKey ) ; $ childPart = $ resourceLocatorStrategy -> getChildPart ( ... | Updates the property for the resource segment on the given node . |
11,503 | private function handle ( Request $ request ) { $ kernel = $ this -> kernelFactory -> create ( $ this -> environment ) ; try { return $ kernel -> handle ( $ request , HttpKernelInterface :: MASTER_REQUEST , false ) ; } catch ( HttpException $ e ) { if ( $ e -> getPrevious ( ) ) { throw $ e -> getPrevious ( ) ; } throw ... | Handles given request and returns response . |
11,504 | private function createServerAttributes ( PortalInformation $ portalInformation , Request $ currentRequest = null ) { $ server = [ ] ; $ host = null ; $ scheme = 'http' ; $ port = 80 ; if ( $ currentRequest ) { $ server = $ currentRequest -> server -> all ( ) ; $ scheme = $ currentRequest -> getScheme ( ) ; $ host = $ ... | Create server attributes . |
11,505 | private function createPortalInformation ( $ object , $ id , $ webspaceKey , $ locale ) { $ webspace = $ this -> webspaceManager -> findWebspaceByKey ( $ webspaceKey ) ; $ domain = $ this -> requestStack -> getCurrentRequest ( ) -> getHost ( ) ; if ( ! $ webspace ) { throw new WebspaceNotFoundException ( $ object , $ i... | This creates a new portal information based on the given information . This is necessary because it is possible that a webspace defines a language which is not used in any portal . For this case we have to define our own fake PortalInformation object . |
11,506 | public function createNodeInPublicWorkspace ( PersistEvent $ event ) { $ node = $ event -> getNode ( ) ; if ( $ node -> isNew ( ) ) { $ this -> createNodesWithUuid ( $ node ) ; return ; } $ liveNode = $ this -> getLiveNode ( $ event -> getDocument ( ) ) ; $ nodeName = $ node -> getName ( ) ; if ( $ liveNode -> getName ... | Creates the node with the same UUID in the public workspace if it does not exist yet . In case it does it will be renamed if necessary . |
11,507 | public function removeNodeFromPublicWorkspace ( RemoveEvent $ event ) { $ document = $ event -> getDocument ( ) ; $ metadata = $ this -> metadataFactory -> getMetadataForClass ( get_class ( $ document ) ) ; if ( ! $ metadata -> getSyncRemoveLive ( ) ) { return ; } $ this -> getLiveNode ( $ document ) -> remove ( ) ; } | Since deleting is not draftable the node will be deleted in the live session as soon as it is deleted in the default session . |
11,508 | public function moveNodeInPublicWorkspace ( MoveEvent $ event ) { $ liveNode = $ this -> getLiveNode ( $ event -> getDocument ( ) ) ; $ this -> nodeHelper -> move ( $ liveNode , $ event -> getDestId ( ) , $ event -> getDestName ( ) ) ; } | Since moving is not draftable the node will also be moved in the live session immediately . |
11,509 | public function reorderNodeInPublicWorkspace ( ReorderEvent $ event ) { $ node = $ this -> getLiveNode ( $ event -> getDocument ( ) ) ; $ this -> nodeHelper -> reorder ( $ node , $ event -> getDestId ( ) ) ; $ count = 1 ; foreach ( $ node -> getParent ( ) -> getNodes ( ) as $ childNode ) { $ childNode -> setProperty ( ... | Reordering is also not draftable and therefore also immediately applied to the live session . |
11,510 | public function removePropertiesFromPublicWorkspace ( UnpublishEvent $ event ) { $ node = $ event -> getNode ( ) ; $ locale = $ event -> getLocale ( ) ; $ this -> removeLocalizedNodeProperties ( $ node , $ locale ) ; } | Removes all the properties for the given locale from the node so that the content is not accessible anymore from the live workspace . |
11,511 | private function createNodesWithUuid ( NodeInterface $ node ) { $ path = $ node -> getPath ( ) ; if ( $ this -> liveSession -> itemExists ( $ path ) ) { return ; } $ currentDefaultNode = $ node -> getSession ( ) -> getRootNode ( ) ; $ currentLiveNode = $ this -> liveSession -> getRootNode ( ) ; $ pathSegments = explode... | Creates every node on the path to the given node . Also uses the same UUIDs for these nodes . |
11,512 | private function removeLocalizedNodeProperties ( NodeInterface $ node , $ locale ) { foreach ( $ node -> getProperties ( $ this -> propertyEncoder -> localizedSystemName ( '' , $ locale ) . '*' ) as $ property ) { $ property -> remove ( ) ; } foreach ( $ node -> getProperties ( $ this -> propertyEncoder -> localizedCon... | Removes all localized properties in the given locale from the given node . |
11,513 | private function loadProperties ( & $ tags , \ DOMXPath $ xpath , \ DOMNode $ context ) : array { $ result = [ ] ; foreach ( $ xpath -> query ( 'x:*' , $ context ) as $ node ) { if ( 'property' === $ node -> tagName ) { $ value = $ this -> loadProperty ( $ xpath , $ node , $ tags ) ; $ result [ $ value [ 'name' ] ] = $... | load properties from given context . |
11,514 | private function loadProperty ( \ DOMXPath $ xpath , \ DOMNode $ node , & $ tags ) { $ result = $ this -> loadValues ( $ xpath , $ node , [ 'name' , 'type' , 'minOccurs' , 'maxOccurs' , 'colspan' , 'cssClass' , 'spaceAfter' , 'disabledCondition' , 'visibleCondition' , ] ) ; $ result [ 'mandatory' ] = $ this -> getValue... | load single property . |
11,515 | private function validateTag ( $ tag , & $ tags ) { if ( ! isset ( $ tags [ $ tag [ 'name' ] ] ) ) { $ tags [ $ tag [ 'name' ] ] = [ ] ; } $ tags [ $ tag [ 'name' ] ] [ ] = $ tag [ 'priority' ] ; } | validates a single tag . |
11,516 | private function loadTag ( \ DOMXPath $ xpath , \ DOMNode $ node ) { $ tag = [ 'name' => null , 'priority' => null , 'attributes' => [ ] , ] ; foreach ( $ node -> attributes as $ key => $ attr ) { if ( in_array ( $ key , [ 'name' , 'priority' ] ) ) { $ tag [ $ key ] = $ attr -> value ; } else { $ tag [ 'attributes' ] [... | load single tag . |
11,517 | private function loadBlock ( \ DOMXPath $ xpath , \ DOMNode $ node , & $ tags ) { $ result = $ this -> loadValues ( $ xpath , $ node , [ 'name' , 'default-type' , 'minOccurs' , 'maxOccurs' , 'colspan' , 'cssClass' , 'disabledCondition' , 'visibleCondition' , ] ) ; $ result [ 'mandatory' ] = $ this -> getValueFromXPath ... | load single block . |
11,518 | private function loadTags ( & $ tags , \ DOMXPath $ xpath , \ DOMNode $ context = null ) { $ result = [ ] ; foreach ( $ xpath -> query ( 'x:tag' , $ context ) as $ node ) { $ tag = $ this -> loadTag ( $ xpath , $ node ) ; $ this -> validateTag ( $ tag , $ tags ) ; $ result [ ] = $ tag ; } return $ result ; } | load tags from given tag and validates them . |
11,519 | private function loadTypes ( & $ tags , \ DOMXPath $ xpath , \ DOMNode $ context = null ) { $ result = [ ] ; foreach ( $ xpath -> query ( 'x:types/x:type' , $ context ) as $ node ) { $ value = $ this -> loadType ( $ xpath , $ node , $ tags ) ; $ result [ $ value [ 'name' ] ] = $ value ; } return $ result ; } | load types from given node . |
11,520 | private function loadValues ( \ DOMXPath $ xpath , \ DOMNode $ node , $ keys , $ prefix = '@' ) { $ result = [ ] ; foreach ( $ keys as $ key ) { $ result [ $ key ] = $ this -> getValueFromXPath ( $ prefix . $ key , $ xpath , $ node ) ; } return $ result ; } | load values defined by key from given node . |
11,521 | private function loadParams ( $ path , \ DOMXPath $ xpath , \ DOMNode $ context = null ) { $ result = [ ] ; foreach ( $ xpath -> query ( $ path , $ context ) as $ node ) { $ result [ ] = $ this -> loadParam ( $ xpath , $ node ) ; } return $ result ; } | load params from given node . |
11,522 | public function setAddress ( \ Sulu \ Bundle \ ContactBundle \ Entity \ Address $ address ) { $ this -> address = $ address ; return $ this ; } | Set address . |
11,523 | private function isUnique ( RouteInterface $ route ) { $ persistedRoute = $ this -> routeRepository -> findByPath ( $ route -> getPath ( ) , $ route -> getLocale ( ) ) ; return ! $ persistedRoute ; } | Returns true if route is unique . |
11,524 | private function resolve ( RouteInterface $ route , RoutableInterface $ entity ) { $ persistedRoute = $ this -> routeRepository -> findByPath ( $ route -> getPath ( ) , $ route -> getLocale ( ) ) ; if ( ! $ persistedRoute ) { return $ route ; } if ( $ persistedRoute -> getEntityClass ( ) === $ route -> getEntityClass (... | Looks for the same route in the database . If no route was found the method returns the newly created route . If the route is a history route for given entity the history route will be returned . Else a RouteIsNotUniqueException will be thrown . |
11,525 | public function setBlamesOnDocument ( HydrateEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ document ) ) { return ; } $ node = $ event -> getNode ( ) ; $ locale = $ event -> getLocale ( ) ; $ encoding = $ this -> getPropertyEncoding ( $ document ) ; $ accessor = $ event -> get... | Sets the changer and creator of the document . |
11,526 | public function setBlamesOnNodeForPersist ( PersistEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ document ) ) { return ; } $ this -> setBlamesOnNode ( $ document , $ event -> getNode ( ) , $ event -> getLocale ( ) , $ event -> getAccessor ( ) , $ event -> getOption ( 'user' )... | Sets the creator and changer for the persist event . |
11,527 | public function setBlamesOnNodeForPublish ( PublishEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ document ) ) { return ; } $ this -> setBlamesOnNode ( $ document , $ event -> getNode ( ) , $ event -> getLocale ( ) , $ event -> getAccessor ( ) , $ document -> getChanger ( ) ) ... | Sets the creator and changer for the publish event . |
11,528 | public function setBlamesOnNode ( LocalizedBlameBehavior $ document , NodeInterface $ node , $ locale , DocumentAccessor $ accessor , $ userId ) { if ( ! $ document instanceof BlameBehavior && ! $ locale ) { return ; } $ encoding = $ this -> getPropertyEncoding ( $ document ) ; $ creatorPropertyName = $ this -> propert... | Persists the data of creator and changer to the Node . |
11,529 | public function setChangerForRestore ( RestoreEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ event -> getDocument ( ) ) ) { return ; } $ encoding = $ this -> getPropertyEncoding ( $ document ) ; $ event -> getNode ( ) -> setProperty ( $ this -> propertyEncoder -> encode ( $ en... | Sets the changer for the restore event . |
11,530 | private function evaluateTargetGroup ( TargetGroupInterface $ targetGroup ) { foreach ( $ targetGroup -> getRules ( ) as $ targetGroupRule ) { if ( $ this -> evaluateTargetGroupRule ( $ targetGroupRule ) ) { return true ; } } return false ; } | Evaluates if one of the rules of the given TargetGroup match . If one of these rules are matching the entire target group is matching . |
11,531 | private function evaluateTargetGroupRule ( TargetGroupRuleInterface $ targetGroupRule ) { foreach ( $ targetGroupRule -> getConditions ( ) as $ targetGroupCondition ) { $ rule = $ this -> ruleCollection -> getRule ( $ targetGroupCondition -> getType ( ) ) ; if ( ! $ rule -> evaluate ( $ targetGroupCondition -> getCondi... | Evaluates if the given rule is matching . Only returns true if all of the conditions are matching . |
11,532 | public function addParameters ( array $ params ) { if ( ! is_array ( $ params ) ) { throw new \ InvalidArgumentException ( '$params has to be an array' ) ; } $ this -> parameters = array_merge ( $ this -> parameters , $ params ) ; } | adds array of parameters . |
11,533 | private function processNavigationItem ( NavigationItem $ navigationItem ) : void { if ( ! $ navigationItem -> getLabel ( ) ) { $ navigationItem -> setLabel ( $ this -> translator -> trans ( $ navigationItem -> getName ( ) , [ ] , 'admin' ) ) ; } if ( $ navigationItem -> getMainRoute ( ) ) { $ mainPath = $ this -> rout... | Adds the translation and the child routes to the given navigation item . |
11,534 | public function getAlternateLinks ( $ urls ) { $ webspaceKey = $ this -> requestAnalyzer -> getWebspace ( ) -> getKey ( ) ; $ currentPortal = $ this -> requestAnalyzer -> getPortal ( ) ; $ defaultLocale = null ; if ( null !== $ currentPortal && null !== ( $ defaultLocale = $ currentPortal -> getXDefaultLocalization ( )... | Returns alternate link HTML tags with href - lang attributes . |
11,535 | public function getSeoMetaTags ( $ extension , $ content ) { $ seo = [ ] ; if ( array_key_exists ( 'seo' , $ extension ) ) { $ seo = $ extension [ 'seo' ] ; } $ excerpt = [ ] ; if ( array_key_exists ( 'excerpt' , $ extension ) ) { $ excerpt = $ extension [ 'excerpt' ] ; } if ( ( ! array_key_exists ( 'description' , $ s... | Returns seo meta tags with fallbacks . |
11,536 | private function addFormatFromFormatNode ( \ DOMNode $ formatNode , & $ formats ) { $ key = $ this -> getKeyFromFormatNode ( $ formatNode ) ; $ internal = $ this -> getInternalFlagFromFormatNode ( $ formatNode ) ; $ meta = $ this -> getMetaFromFormatNode ( $ formatNode ) ; $ scale = $ this -> getScaleFromFormatNode ( $... | For a given format node and a given array of formats this method parses the format node to an array and adds it to the formats array . |
11,537 | private function tryLoad ( $ file ) { try { return XmlUtils :: loadFile ( $ file , __DIR__ . static :: SCHEME_PATH ) ; } catch ( \ InvalidArgumentException $ e ) { throw new InvalidMediaFormatException ( sprintf ( 'Could not parse image formats XML file "%s"' , $ file ) , null , $ e ) ; } } | Tries to load the DOM Document of a given image formats xml . |
11,538 | protected function getParametersFromNode ( $ node , $ parameterName = 'parameter' ) { if ( null === $ node ) { return [ ] ; } $ parameters = [ ] ; foreach ( $ this -> xpath -> query ( 'x:' . $ parameterName , $ node ) as $ parameterNode ) { $ name = $ this -> xpath -> query ( '@name' , $ parameterNode ) -> item ( 0 ) -... | For a given dom node returns an array of parameters . The xml name of the parameter tag can be passed as an argument . |
11,539 | private function getOptionsFromFormatNode ( \ DOMNode $ formatNode ) { $ optionsNode = $ this -> xpath -> query ( 'x:options' , $ formatNode ) -> item ( 0 ) ; return $ this -> getParametersFromNode ( $ optionsNode , 'option' ) ; } | For a given format node returns the options for it . |
11,540 | private function findAvailableParentLocalization ( array $ availableLocales , Localization $ localization ) { do { if ( in_array ( $ localization -> getLocale ( ) , $ availableLocales ) ) { return $ localization ; } $ localization = $ localization -> getParent ( ) ; } while ( null != $ localization ) ; return ; } | Finds the next available parent - localization in which the node has a translation . |
11,541 | private function findAvailableChildLocalization ( array $ availableLocales , Localization $ localization ) { $ childrenLocalizations = $ localization -> getChildren ( ) ; if ( ! empty ( $ childrenLocalizations ) ) { foreach ( $ childrenLocalizations as $ childrenLocalization ) { if ( in_array ( $ childrenLocalization -... | Finds the next available child - localization in which the node has a translation . |
11,542 | private function findAvailableLocalization ( array $ availableLocales , array $ localizations ) { foreach ( $ localizations as $ localization ) { if ( in_array ( $ localization -> getLocale ( ) , $ availableLocales ) ) { return $ localization ; } $ children = $ localization -> getChildren ( ) ; if ( $ children ) { $ re... | Finds any localization in which the node is translated . |
11,543 | private function findCategoriesWithoutParents ( ) { $ qb = $ this -> categoryRepository -> createQueryBuilder ( 'c2' ) -> select ( 'count(c2.id)' ) -> leftJoin ( 'c2.parent' , 'c1' ) -> where ( 'c2.depth <> 0 AND c2.parent IS NULL' ) ; return $ qb -> getQuery ( ) -> getSingleScalarResult ( ) ; } | Find number of categories that have no parent but depth > 0 . |
11,544 | private function fixWrongDepthGap ( ) { $ sql = 'UPDATE ca_categories c2 JOIN ca_categories c1 ON c2.idCategoriesParent = c1.id SET c2.depth = (c1.depth + 1) WHERE ( c2.depth - 1 ) <> c1.depth' ; $ statement = $ this -> entityManager -> getConnection ( ) -> prepare ( $ sql )... | Fix categories where difference to parents depth . |
11,545 | private function fixCategoriesWithoutParents ( ) { $ qb = $ this -> categoryRepository -> createQueryBuilder ( 'c2' ) -> update ( ) -> set ( 'c2.depth' , 0 ) -> where ( 'c2.parent IS NULL AND c2.depth != 0' ) ; $ qb -> getQuery ( ) -> execute ( ) ; } | Set every category where depth > 0 and has no parents to depth 0 . |
11,546 | public function loadByArea ( $ area , $ webspaceKey = null , $ locale = null ) { if ( ! $ webspaceKey ) { $ webspaceKey = $ this -> requestAnalyzer -> getWebspace ( ) -> getKey ( ) ; } if ( ! $ locale ) { $ locale = $ this -> requestAnalyzer -> getCurrentLocalization ( ) -> getLocale ( ) ; } try { $ snippet = $ this ->... | Load snippet for webspace by area . |
11,547 | private function addFileSystemNode ( ) { $ builder = new TreeBuilder ( ) ; $ node = $ builder -> root ( 'file_system' ) ; $ node -> addDefaultsIfNotSet ( ) -> children ( ) -> scalarNode ( 'directory' ) -> defaultValue ( '%sulu.cache_dir%/preview' ) -> end ( ) -> scalarNode ( 'extension' ) -> defaultNull ( ) -> end ( ) ... | Build file_system node configuration definition . |
11,548 | private function addRedisNode ( ) { $ builder = new TreeBuilder ( ) ; $ node = $ builder -> root ( 'redis' ) ; $ node -> addDefaultsIfNotSet ( ) -> children ( ) -> scalarNode ( 'connection_id' ) -> defaultNull ( ) -> end ( ) -> scalarNode ( 'host' ) -> defaultValue ( '127.0.0.1' ) -> end ( ) -> scalarNode ( 'port' ) ->... | Build redis node configuration definition . |
11,549 | public function handleBlameTimestamp ( PreIndexEvent $ event ) { $ subject = $ event -> getSubject ( ) ; $ document = $ event -> getDocument ( ) ; if ( $ subject instanceof UserBlameInterface ) { $ this -> mapCreatorAndChanger ( $ document , $ subject -> getCreator ( ) , $ subject -> getChanger ( ) ) ; } if ( $ subject... | Map blame and timestamp information to the search document . |
11,550 | private function getFieldValue ( $ document , $ fieldName ) { if ( false === $ document -> hasField ( $ fieldName ) ) { return ; } return $ document -> getField ( $ fieldName ) -> getValue ( ) ; } | Return the named field from the document or return null . |
11,551 | private function mapTimestamp ( Document $ document , \ DateTime $ created = null , \ DateTime $ changed = null ) { $ document -> addField ( $ this -> factory -> createField ( 'created' , $ created ? $ created -> format ( 'c' ) : null , 'string' ) ) ; $ document -> addField ( $ this -> factory -> createField ( 'changed... | Map timestamps to the search document . |
11,552 | private function mapCreatorAndChanger ( Document $ document , UserInterface $ creator = null , UserInterface $ changer = null ) { $ document -> addField ( $ this -> factory -> createField ( 'changer' , $ changer ? $ changer -> getUsername ( ) : null , 'string' ) ) ; $ document -> addField ( $ this -> factory -> createF... | Map the creator and changer to the document . |
11,553 | protected function printExceptions ( $ import , $ output = null ) { if ( null === $ output ) { $ output = new NullOutput ( ) ; } $ output -> writeln ( [ '' , '' , '<info>Import Result</info>' , '<info>===============</info>' , '<info>' . $ import -> successes . ' Documents imported.</info>' , '<comment>' . count ( $ im... | Print the completion message after import is done . |
11,554 | protected function parseXml ( $ file ) { $ this -> xpath = new \ DOMXPath ( $ this -> tryLoad ( $ file ) ) ; $ this -> xpath -> registerNamespace ( 'x' , 'http://schemas.sulu.io/webspace/webspace' ) ; $ this -> webspace = new Webspace ( ) ; $ this -> webspace -> setName ( $ this -> xpath -> query ( '/x:webspace/x:name'... | Parses the entire file and returns a webspace object . |
11,555 | protected function tryLoad ( $ file ) { try { return XmlUtils :: loadFile ( $ file , __DIR__ . static :: SCHEMA_LOCATION ) ; } catch ( \ InvalidArgumentException $ e ) { throw new InvalidWebspaceException ( sprintf ( 'Could not parse webspace XML file "%s"' , $ file ) , null , $ e ) ; } } | Returns xml - doc when one scheme matches . |
11,556 | protected function loadPortalLocalizationDefaultFromWebspace ( $ portal ) { $ webspaceDefaultLocalization = $ this -> webspace -> getDefaultLocalization ( ) ; foreach ( $ portal -> getLocalizations ( ) as $ localization ) { if ( $ webspaceDefaultLocalization && $ webspaceDefaultLocalization -> getLocale ( ) == $ locali... | Sets the default localization for the given portal . |
11,557 | protected function generatePortalLocalizations ( \ DOMNode $ portalNode , Portal $ portal ) { if ( $ this -> xpath -> query ( 'x:localizations' , $ portalNode ) -> length > 0 ) { $ localizationNodes = $ this -> xpath -> query ( 'x:localizations/x:localization' , $ portalNode ) ; $ this -> generateLocalizationsFromNodeL... | Generates all localizations for the given portal . |
11,558 | protected function generateLocalizationsFromNodeList ( \ DOMNodeList $ localizationNodes , Portal $ portal , $ flat = false ) { foreach ( $ localizationNodes as $ localizationNode ) { $ localization = $ this -> generateLocalizationFromNode ( $ localizationNode , $ flat ) ; $ portal -> addLocalization ( $ localization )... | Generates the localizations for the given portal from the given DOMNodeList . |
11,559 | protected function generateLocalizationFromNode ( \ DOMElement $ localizationNode , $ flat = false , $ parent = null ) { $ localization = new Localization ( ) ; $ localization -> setLanguage ( $ localizationNode -> attributes -> getNamedItem ( 'language' ) -> nodeValue ) ; if ( $ parent ) { $ localization -> setParent ... | Generates a localization from the given node . |
11,560 | protected function generateSecurity ( ) { $ securitySystemNode = $ this -> xpath -> query ( '/x:webspace/x:security/x:system' ) ; if ( $ securitySystemNode -> length > 0 ) { $ security = new Security ( ) ; $ security -> setSystem ( $ securitySystemNode -> item ( 0 ) -> nodeValue ) ; $ this -> webspace -> setSecurity ( ... | Generates and sets the security object from the XML document . |
11,561 | protected function generateWebspaceLocalizations ( ) { foreach ( $ this -> xpath -> query ( '/x:webspace/x:localizations/x:localization' ) as $ localizationNode ) { $ localization = $ this -> generateLocalizationFromNode ( $ localizationNode ) ; $ this -> webspace -> addLocalization ( $ localization ) ; } } | Generates the localization for the webspace from the XML document . |
11,562 | protected function generateSegments ( ) { foreach ( $ this -> xpath -> query ( '/x:webspace/x:segments/x:segment' ) as $ segmentNode ) { $ segment = new Segment ( ) ; $ segment -> setName ( $ segmentNode -> nodeValue ) ; $ segment -> setKey ( $ segmentNode -> attributes -> getNamedItem ( 'key' ) -> nodeValue ) ; $ defa... | Generates the available segments for the webspace from the XML document . |
11,563 | protected function generatePortals ( ) { foreach ( $ this -> xpath -> query ( '/x:webspace/x:portals/x:portal' ) as $ portalNode ) { $ portal = new Portal ( ) ; $ portal -> setName ( $ this -> xpath -> query ( 'x:name' , $ portalNode ) -> item ( 0 ) -> nodeValue ) ; $ portal -> setKey ( $ this -> xpath -> query ( 'x:ke... | Generate all the portals for the webspace . |
11,564 | protected function generateTheme ( ) { $ nodes = $ this -> xpath -> query ( '/x:webspace/x:theme/x:key' ) ; if ( $ nodes -> length > 0 ) { return $ nodes -> item ( 0 ) -> nodeValue ; } $ nodes = $ this -> xpath -> query ( '/x:webspace/x:theme' ) ; if ( 0 === $ nodes -> length ) { return ; } return $ nodes -> item ( 0 )... | Generates the theme for the webspace . |
11,565 | protected function generateTemplates ( Webspace $ webspace ) { $ defaultErrorTemplates = 0 ; foreach ( $ this -> xpath -> query ( '/x:webspace/x:theme/x:error-templates/x:error-template' ) as $ errorTemplateNode ) { $ template = $ errorTemplateNode -> nodeValue ; if ( null !== ( $ codeNode = $ errorTemplateNode -> attr... | Generates the available template types for the given webspace . |
11,566 | protected function generateDefaultTemplates ( Webspace $ webspace ) { $ expected = [ 'page' , 'home' ] ; foreach ( $ this -> xpath -> query ( '/x:webspace/x:theme/x:default-templates/x:default-template' ) as $ node ) { $ template = $ node -> nodeValue ; $ type = $ node -> attributes -> getNamedItem ( 'type' ) -> nodeVa... | Generates the default templates for the webspace . |
11,567 | protected function generateNavigation ( ) { $ contexts = [ ] ; foreach ( $ this -> xpath -> query ( '/x:webspace/x:navigation/x:contexts/x:context' ) as $ contextNode ) { $ contexts [ ] = new NavigationContext ( $ contextNode -> attributes -> getNamedItem ( 'key' ) -> nodeValue , $ this -> loadMeta ( 'x:meta/x:*' , $ c... | Generates the availabel navigation contexts for the webspace . |
11,568 | protected function loadMeta ( $ path , \ DOMNode $ context = null ) { $ result = [ ] ; foreach ( $ this -> xpath -> query ( $ path , $ context ) as $ node ) { $ attribute = $ node -> tagName ; $ lang = $ this -> xpath -> query ( '@lang' , $ node ) -> item ( 0 ) -> nodeValue ; if ( ! isset ( $ result [ $ node -> tagName... | Loads the meta information like a translatable title from the webspace . |
11,569 | protected function generateEnvironments ( \ DOMNode $ portalNode , Portal $ portal ) { foreach ( $ this -> xpath -> query ( 'x:environments/x:environment' , $ portalNode ) as $ environmentNode ) { $ environment = new Environment ( ) ; $ environment -> setType ( $ environmentNode -> attributes -> getNamedItem ( 'type' )... | Generates the definitions for the available environments for this webspace . |
11,570 | protected function generateUrls ( \ DOMNode $ environmentNode , Environment $ environment ) { foreach ( $ this -> xpath -> query ( 'x:urls/x:url' , $ environmentNode ) as $ urlNode ) { if ( ! $ this -> checkUrlNode ( $ urlNode ) ) { throw new InvalidUrlDefinitionException ( $ this -> webspace , $ urlNode -> nodeValue )... | Generates the URLs for the given environment . |
11,571 | protected function generateCustomUrls ( \ DOMNode $ environmentNode , Environment $ environment ) { foreach ( $ this -> xpath -> query ( 'x:custom-urls/x:custom-url' , $ environmentNode ) as $ urlNode ) { $ url = new CustomUrl ( ) ; $ url -> setUrl ( rtrim ( $ urlNode -> nodeValue , '/' ) ) ; if ( false === strpos ( $ ... | Generates the custom URLs from the XML document . |
11,572 | protected function getOptionalNodeAttribute ( \ DOMNode $ node , $ name , $ default = null ) { $ attribute = $ node -> attributes -> getNamedItem ( $ name ) ; if ( $ attribute ) { return $ attribute -> nodeValue ; } return $ default ; } | Returns an optional value from the given node . The default value will be used if the node does not exist . |
11,573 | protected function checkUrlNode ( \ DOMNode $ urlNode ) { $ hasLocalization = ( null != $ urlNode -> attributes -> getNamedItem ( 'localization' ) ) || ( false !== strpos ( $ urlNode -> nodeValue , '{localization}' ) ) ; $ hasLanguage = ( null != $ urlNode -> attributes -> getNamedItem ( 'language' ) ) || ( false !== s... | Checks if the urlNode is valid for this webspace . |
11,574 | protected function validateWebspaceDefaultLocalization ( ) { try { $ this -> validateDefaultLocalization ( $ this -> webspace -> getLocalizations ( ) ) ; } catch ( InvalidDefaultLocalizationException $ ex ) { throw new InvalidWebspaceDefaultLocalizationException ( $ this -> webspace ) ; } } | Validate default webspace localization . |
11,575 | protected function validateDefaultPortalLocalization ( ) { foreach ( $ this -> webspace -> getPortals ( ) as $ portal ) { try { if ( ! $ this -> validateDefaultLocalization ( $ portal -> getLocalizations ( ) ) ) { if ( ! $ this -> loadPortalLocalizationDefaultFromWebspace ( $ portal ) ) { throw new PortalDefaultLocaliz... | Validate portal localization . |
11,576 | protected function validateWebspaceDefaultSegment ( ) { $ segments = $ this -> webspace -> getSegments ( ) ; if ( $ segments ) { $ webspaceDefaultSegmentFound = false ; foreach ( $ segments as $ webspaceSegment ) { if ( $ webspaceSegment -> isDefault ( ) ) { if ( $ webspaceDefaultSegmentFound ) { throw new InvalidWebsp... | Validate webspace default segment . |
11,577 | protected function validateDefaultLocalization ( $ localizations ) { $ result = false ; foreach ( $ localizations as $ localization ) { if ( $ localization -> isDefault ( ) ) { if ( $ result ) { throw new InvalidDefaultLocalizationException ( ) ; } $ result = true ; } } return $ result ; } | Returns true if there is one default localization . |
11,578 | private function getIdsQuery ( $ depth = 0 , $ filter = [ ] , $ sortBy = [ ] , CollectionInterface $ collection = null , $ select = 'collection.id' ) { $ queryBuilder = $ this -> createQueryBuilder ( 'collection' ) -> select ( $ select ) -> where ( 'collection.depth <= :depth' ) ; $ collectionDepth = null !== $ collect... | Returns the basic query which selects the ids of a collection for a given set of parameters . |
11,579 | public function refreshDocument ( RefreshEvent $ event ) { $ document = $ event -> getDocument ( ) ; $ node = $ this -> documentRegistry -> getNodeForDocument ( $ document ) ; $ locale = $ this -> documentRegistry -> getLocaleForDocument ( $ document ) ; $ node -> revert ( ) ; $ this -> rehydrateDocument ( $ document ,... | Refreshes the document when the DocumentManager method for it is called . |
11,580 | public function refreshDocumentForDeleteDraft ( RemoveDraftEvent $ event ) { $ this -> rehydrateDocument ( $ event -> getDocument ( ) , $ event -> getNode ( ) , $ event -> getLocale ( ) ) ; } | Refreshes the document after a draft have been removed . |
11,581 | private function rehydrateDocument ( $ document , NodeInterface $ node , $ locale ) { $ hydrateEvent = new HydrateEvent ( $ node , $ locale , [ 'rehydrate' => true ] ) ; $ hydrateEvent -> setDocument ( $ document ) ; $ this -> eventDispatcher -> dispatch ( Events :: HYDRATE , $ hydrateEvent ) ; } | Rehydrates the given document from the given node for the given locale . |
11,582 | public function targetGroupAction ( Request $ request ) { $ currentTargetGroup = null ; if ( $ request -> headers -> has ( $ this -> targetGroupHeader ) ) { $ currentTargetGroup = $ this -> targetGroupRepository -> find ( $ request -> headers -> get ( $ this -> targetGroupHeader ) ) ; } $ targetGroup = $ this -> target... | Takes the request and evaluates a target group based on the request . |
11,583 | public function targetGroupHitAction ( ) { $ currentTargetGroup = $ this -> targetGroupRepository -> find ( $ this -> targetGroupStore -> getTargetGroupId ( true ) ) ; $ targetGroup = $ this -> targetGroupEvaluator -> evaluate ( TargetGroupRuleInterface :: FREQUENCY_HIT , $ currentTargetGroup ) ; $ response = new Respo... | This end point is called by the injected code on the website to update the target group on every hit . |
11,584 | protected function updateConditionGroup ( ConditionGroupEntity $ conditionGroup , $ matchedEntry ) { if ( array_key_exists ( 'id' , $ matchedEntry ) && isset ( $ matchedEntry [ 'conditions' ] ) ) { $ conditionIds = [ ] ; foreach ( $ matchedEntry [ 'conditions' ] as $ conditionData ) { if ( array_key_exists ( 'id' , $ c... | Updates the given condition group with the values from the given array . |
11,585 | protected function getValueForCondition ( $ value , $ type ) { if ( DataTypes :: DATETIME_TYPE === $ type && ! preg_match ( '/[A-Za-z]{3,}/' , $ value ) ) { return ( new \ DateTime ( $ value ) ) -> format ( \ DateTime :: ISO8601 ) ; } return $ value ; } | Parses the value for a condition - is mainly used for parsing values with type datetime but excludes relative values like - 1 week or now . |
11,586 | protected function addConditionGroup ( Filter $ filter , $ conditionGroupData ) { if ( array_key_exists ( 'id' , $ conditionGroupData ) ) { throw new EntityIdAlreadySetException ( self :: $ conditionGroupEntityName , $ conditionGroupData [ 'id' ] ) ; } elseif ( array_key_exists ( 'conditions' , $ conditionGroupData ) )... | Adds a condition group to the given filter . |
11,587 | protected function isValidConditionData ( $ data ) { if ( ! array_key_exists ( 'field' , $ data ) ) { throw new MissingConditionAttributeException ( 'field' ) ; } if ( ! array_key_exists ( 'operator' , $ data ) ) { throw new MissingConditionAttributeException ( 'operator' ) ; } if ( ! array_key_exists ( 'type' , $ data... | Checks if the given data is correct for a condition . |
11,588 | public function getFeaturesForContext ( $ context ) { if ( $ this -> contextConfiguration && array_key_exists ( $ context , $ this -> contextConfiguration ) ) { return $ this -> contextConfiguration [ $ context ] [ 'features' ] ; } return ; } | Returns the configured features for a context . |
11,589 | protected function removeNonExistentConditions ( $ conditionGroup , $ conditionIds ) { foreach ( $ conditionGroup -> getConditions ( ) as $ condition ) { if ( $ condition -> getId ( ) && ! in_array ( $ condition -> getId ( ) , $ conditionIds ) ) { $ conditionGroup -> removeCondition ( $ condition ) ; $ this -> em -> re... | Removes conditions from condition groups when they are not in the given array . |
11,590 | public function hasContext ( $ context ) { if ( $ this -> contextConfiguration && array_key_exists ( $ context , $ this -> contextConfiguration ) ) { return true ; } return false ; } | Checks if the context exists . |
11,591 | public function isFeatureEnabled ( $ context , $ feature ) { if ( $ this -> hasContext ( $ context ) && false !== array_search ( $ feature , $ this -> getFeaturesForContext ( $ context ) ) ) { return true ; } return false ; } | Checks if a feature is enabled for a context . |
11,592 | public function findFiltersForUserAndContext ( $ context , $ userId , $ locale ) { $ filters = $ this -> filterRepository -> findByUserAndContextAndLocale ( $ locale , $ context , $ userId ) ; array_walk ( $ filters , function ( & $ filter ) use ( $ locale ) { $ filter = new Filter ( $ filter , $ locale ) ; } ) ; retur... | Finds all filters filtered by context and user and for the given locale . |
11,593 | private function buildData ( $ uploadedFile , $ data , $ user ) { if ( ! ( $ uploadedFile instanceof UploadedFile ) ) { throw new InvalidFileException ( 'Given uploaded file is not of instance UploadedFile' ) ; } $ this -> validator -> validate ( $ uploadedFile ) ; $ data [ 'storageOptions' ] = $ this -> storage -> sav... | Prepares data . |
11,594 | protected function createMedia ( $ data , $ user ) { $ mediaEntity = $ this -> mediaRepository -> createNew ( ) ; $ mediaEntity -> setCreator ( $ user ) ; $ mediaEntity -> setChanger ( $ user ) ; $ file = new File ( ) ; $ file -> setCreator ( $ user ) ; $ file -> setChanger ( $ user ) ; $ file -> setVersion ( 1 ) ; $ f... | Create a new media . |
11,595 | protected function getCurrentUser ( ) { if ( ! $ this -> tokenStorage ) { return ; } if ( ! $ this -> tokenStorage -> getToken ( ) ) { return ; } $ user = $ this -> tokenStorage -> getToken ( ) -> getUser ( ) ; if ( $ user instanceof UserInterface ) { return $ user ; } return ; } | Returns current user or null if no user is loggedin . |
11,596 | private function getNormalizedFileName ( $ originalFileName ) { if ( false !== strpos ( $ originalFileName , '.' ) ) { $ pathParts = pathinfo ( $ originalFileName ) ; $ fileName = $ this -> pathCleaner -> cleanup ( $ pathParts [ 'filename' ] ) ; $ fileName .= '.' . $ pathParts [ 'extension' ] ; } else { $ fileName = $ ... | Returns file name without special characters and preserves file extension . |
11,597 | public function toArray ( ) { $ res = [ ] ; foreach ( $ this -> locations as $ location ) { $ res [ ] = $ location -> toArray ( ) ; } return $ res ; } | Return an array representation of the response . |
11,598 | public function initialize ( OutputInterface $ output = null , $ purge = false ) { $ output = $ output ? : new NullOutput ( ) ; arsort ( $ this -> initializerMap ) ; foreach ( array_keys ( $ this -> initializerMap ) as $ initializerId ) { $ output -> writeln ( sprintf ( '<comment>%s</>' , $ initializerId ) ) ; $ initia... | Initialize the content repository optionally purging it before - hand . |
11,599 | public function getWebspaceCollection ( ) { if ( null === $ this -> webspaceCollection ) { $ class = $ this -> options [ 'cache_class' ] ; $ cache = new ConfigCache ( $ this -> options [ 'cache_dir' ] . '/' . $ class . '.php' , $ this -> options [ 'debug' ] ) ; if ( ! $ cache -> isFresh ( ) ) { $ webspaceCollectionBuil... | Returns all the webspaces managed by this specific instance . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.