idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
10,900 | public function getPlural ( $ Number , $ String ) { if ( isset ( $ this -> Data [ $ String ] ) ) { $ Choices = $ this -> Data [ $ String ] ; $ IntegerRule = $ this -> IntegerRule ; $ FractionRule = $ this -> FractionRule ; } elseif ( isset ( $ this -> Fallback [ $ String ] ) ) { $ Choices = $ this -> Fallback [ $ Strin... | Fetch an L10N string from a range of possible plural forms . |
10,901 | public function getString ( $ String ) { if ( isset ( $ this -> Data [ $ String ] ) ) { return $ this -> Data [ $ String ] ; } return isset ( $ this -> Fallback [ $ String ] ) ? $ this -> Fallback [ $ String ] : '' ; } | Safely fetch an L10N string . |
10,902 | private function normaliseValue ( & $ Value , $ ValueLen , $ ValueLow ) { foreach ( [ [ '"' , '"' , 1 ] , [ "'" , "'" , 1 ] , [ '`' , '`' , 1 ] , [ "\x91" , "\x92" , 1 ] , [ "\x93" , "\x94" , 1 ] , [ "\xe2\x80\x98" , "\xe2\x80\x99" , 3 ] , [ "\xe2\x80\x9c" , "\xe2\x80\x9d" , 3 ] ] as $ Wrapper ) { if ( substr ( $ Value... | Normalises the values defined by the processLine method . |
10,903 | private function TryX ( $ Using ) { if ( ! function_exists ( $ Using ) ) { return 1 ; } $ Try = $ Using ( $ this -> Data ) ; if ( $ Try !== false && is_string ( $ Try ) ) { $ this -> Data = $ Try ; return 0 ; } return 2 ; } | The basis for the other try methods . |
10,904 | public function TryEverything ( ) { $ Original = $ this -> Data ; $ Errors = & $ this -> Errors ; set_error_handler ( function ( $ errno , $ errstr , $ errfile , $ errline ) use ( & $ Errors ) { $ Errors [ ] = [ $ errno , $ errstr , $ errfile , $ errline ] ; } ) ; while ( true ) { if ( $ this -> TryGz ( ) === 0 ) { con... | Try everything . |
10,905 | public function EntryCRC ( ) { return ( isset ( $ this -> StatIndex [ 'crc' ] ) && is_int ( $ this -> StatIndex [ 'crc' ] ) ) ? dechex ( $ this -> StatIndex [ 'crc' ] ) : false ; } | Return the reported internal CRC hash for the entry if it exists . |
10,906 | public function EntryIsDirectory ( ) { $ Name = $ this -> EntryName ( ) ; return ( ( substr ( $ Name , - 1 , 1 ) === "\\" || substr ( $ Name , - 1 , 1 ) === '/' ) && $ this -> EntryActualSize === 0 ) ; } | Return whether the entry at the current entry pointer is a directory . |
10,907 | private function mapParent ( $ document , NodeInterface $ node , $ options = [ ] ) { $ targetNode = $ node -> getParent ( ) ; if ( ! $ targetNode -> hasProperty ( 'jcr:uuid' ) ) { return ; } $ document -> setParent ( $ this -> proxyFactory -> createProxyForNode ( $ document , $ targetNode , $ options ) ) ; } | Map parent document to given document . |
10,908 | private function getImageUrl ( $ media , $ locale ) { $ mediaApi = new Media ( $ media , $ locale ) ; $ this -> mediaManager -> addFormatsAndUrl ( $ mediaApi ) ; $ formats = $ mediaApi -> getThumbnails ( ) ; if ( ! isset ( $ formats [ $ this -> searchImageFormat ] ) ) { $ this -> logger -> warning ( sprintf ( 'Media wi... | Return the image URL for the given media . |
10,909 | public function removeSystemFields ( ) { $ properties = $ this -> fields ; unset ( $ properties [ 'created' ] , $ properties [ 'changed' ] , $ properties [ 'changer' ] , $ properties [ 'changer_id' ] , $ properties [ 'creator' ] , $ properties [ 'creator_id' ] ) ; foreach ( $ properties as $ key => $ field ) { if ( '__... | Called by the JMS Serializer before the document is serialized for the web API . |
10,910 | public function find ( $ identifier ) { try { if ( UUIDHelper :: isUUID ( $ identifier ) ) { return $ this -> session -> getNodeByIdentifier ( $ identifier ) ; } return $ this -> session -> getNode ( $ identifier ) ; } catch ( RepositoryException $ e ) { throw new DocumentNotFoundException ( sprintf ( 'Could not find d... | Find a document with the given path or UUID . |
10,911 | public function has ( $ identifier ) { $ this -> normalizeToPath ( $ identifier ) ; try { $ this -> find ( $ identifier ) ; return true ; } catch ( DocumentNotFoundException $ e ) { return false ; } } | Determine if a node exists at the specified path or if a UUID is given then if a node with the UUID exists . |
10,912 | public function remove ( $ identifier ) { $ identifier = $ this -> normalizeToPath ( $ identifier ) ; $ this -> session -> removeItem ( $ identifier ) ; } | Remove the document with the given path or UUID . |
10,913 | public function createPath ( $ path ) { $ current = $ this -> session -> getRootNode ( ) ; $ segments = preg_split ( '#/#' , $ path , null , PREG_SPLIT_NO_EMPTY ) ; foreach ( $ segments as $ segment ) { if ( $ current -> hasNode ( $ segment ) ) { $ current = $ current -> getNode ( $ segment ) ; } else { $ current = $ c... | Create a path . |
10,914 | private function normalizeToPath ( $ identifier ) { if ( UUIDHelper :: isUUID ( $ identifier ) ) { $ identifier = $ this -> session -> getNodeByIdentifier ( $ identifier ) -> getPath ( ) ; } return $ identifier ; } | Normalize the given path or ID to a path . |
10,915 | private function handleOverwrite ( KeywordInterface $ keyword , CategoryInterface $ category ) { if ( null !== $ synonym = $ this -> findSynonym ( $ keyword ) ) { if ( $ this -> entityManager -> contains ( $ keyword ) ) { $ this -> entityManager -> refresh ( $ keyword ) ; } $ this -> delete ( $ keyword , $ category ) ;... | Overwrites given keyword . |
10,916 | private function handleDetach ( KeywordInterface $ keyword , CategoryInterface $ category ) { $ keywordString = $ keyword -> getKeyword ( ) ; $ keywordLocale = $ keyword -> getLocale ( ) ; $ this -> entityManager -> refresh ( $ keyword ) ; $ this -> delete ( $ keyword , $ category ) ; $ newEntity = $ this -> keywordRep... | Detach given and create new keyword entity . |
10,917 | private function findSynonym ( KeywordInterface $ keyword ) { return $ this -> keywordRepository -> findByKeyword ( $ keyword -> getKeyword ( ) , $ keyword -> getLocale ( ) ) ; } | Find the same keyword in the database or returns null if no synonym exists . |
10,918 | private function createTranslation ( CategoryInterface $ category , $ locale ) { $ categoryTranslation = $ this -> categoryTranslationRepository -> createNew ( ) ; $ categoryTranslation -> setLocale ( $ locale ) ; $ categoryTranslation -> setTranslation ( '' ) ; $ categoryTranslation -> setCategory ( $ category ) ; $ c... | Creates a new category translation for a given category and locale . |
10,919 | public function getMediaUrl ( Media $ media , $ dispositionType = null ) { $ url = $ media -> getUrl ( ) ; if ( ResponseHeaderBag :: DISPOSITION_INLINE === $ dispositionType ) { $ url .= ( false === strpos ( $ url , '?' ) ? '?inline=1' : '&inline=1' ) ; } elseif ( ResponseHeaderBag :: DISPOSITION_ATTACHMENT === $ dispo... | Get media url . |
10,920 | public function isValidLocale ( $ language , $ country ) { return ( $ this -> getLanguage ( ) === $ language && $ this -> getCountry ( ) === $ country ) || ( empty ( $ this -> getLanguage ( ) ) && empty ( $ this -> getCountry ( ) ) ) ; } | Checks if this URL handles the locale for the given language and country . |
10,921 | public function setTimestampsOnDocument ( HydrateEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ document ) ) { return ; } $ accessor = $ event -> getAccessor ( ) ; $ node = $ event -> getNode ( ) ; $ locale = $ this -> documentInspector -> getOriginalLocale ( $ document ) ; $ ... | Sets the timestamps from the node to the document . |
10,922 | public function setTimestampsOnNodeForPersist ( PersistEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ document ) ) { return ; } $ this -> setTimestampsOnNode ( $ document , $ event -> getNode ( ) , $ event -> getAccessor ( ) , $ this -> documentInspector -> getOriginalLocale (... | Sets the timestamps on the nodes for the persist operation . |
10,923 | public function setTimestampsOnNode ( LocalizedTimestampBehavior $ document , NodeInterface $ node , DocumentAccessor $ accessor , $ locale , $ timestamp = null ) { if ( ! $ document instanceof TimestampBehavior && ! $ locale ) { return ; } $ encoding = $ this -> getPropertyEncoding ( $ document ) ; $ createdPropertyNa... | Set the timestamps on the node . |
10,924 | public function setChangedForRestore ( RestoreEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ this -> supports ( $ document ) ) { return ; } $ encoding = $ this -> getPropertyEncoding ( $ document ) ; $ event -> getNode ( ) -> setProperty ( $ this -> propertyEncoder -> encode ( $ encoding , static ... | Sets the changed timestamp when restoring a document . |
10,925 | public function createTranslatedProperty ( $ property , $ locale , StructureInterface $ structure = null ) { if ( $ property instanceof ItemMetadata ) { $ property = $ this -> createProperty ( $ property , $ structure ) ; } $ property = new TranslatedProperty ( $ property , $ locale , $ this -> namespaceRegistry -> get... | Create a new translated property . |
10,926 | public function createProperty ( ItemMetadata $ property , StructureInterface $ structure = null ) { if ( $ property instanceof SectionMetadata ) { return $ this -> createSectionProperty ( $ property , $ structure ) ; } if ( $ property instanceof BlockMetadata ) { return $ this -> createBlockProperty ( $ property , $ s... | Create a new property . |
10,927 | public function onPostSerialize ( ObjectEvent $ event ) { $ document = $ event -> getObject ( ) ; if ( ! $ document instanceof ChildrenBehavior || ! $ this -> documentRegistry -> hasDocument ( $ document ) ) { return ; } $ visitor = $ event -> getVisitor ( ) ; $ visitor -> addData ( 'hasSub' , $ this -> documentInspect... | Adds a flag to indicate if the document has children . |
10,928 | protected function getParser ( $ format ) { if ( ! isset ( $ this -> formatFilePaths [ $ format ] ) ) { throw new FormatImporterNotFoundException ( $ format ) ; } return $ this -> formatFilePaths [ $ format ] ; } | Returns the correct parser like XLIFF1 . 2 . |
10,929 | protected function importProperty ( PropertyInterface $ property , NodeInterface $ node , StructureInterface $ structure , $ value , $ webspaceKey , $ locale , $ format ) { $ contentType = $ property -> getContentTypeName ( ) ; if ( ! $ this -> importManager -> hasImport ( $ contentType , $ format ) ) { return ; } $ tr... | Prepare document - property and import them . |
10,930 | protected function decorateResourceItems ( array $ data , $ locale ) { return array_map ( function ( $ item ) { $ itemData = $ this -> serializer -> serialize ( $ item , 'array' , $ this -> getSerializationContext ( ) ) ; $ id = $ this -> getIdForItem ( $ item ) ; if ( $ this -> referenceStore ) { $ this -> referenceSt... | Decorates result as resource item . |
10,931 | public function addUrl ( \ Sulu \ Bundle \ ContactBundle \ Entity \ Url $ urls ) { $ this -> urls [ ] = $ urls ; return $ this ; } | Add urls . |
10,932 | public function removeUrl ( \ Sulu \ Bundle \ ContactBundle \ Entity \ Url $ urls ) { $ this -> urls -> removeElement ( $ urls ) ; } | Remove urls . |
10,933 | public function indexDocumentAfterRemoveDraft ( RemoveDraftEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( $ document instanceof WorkflowStageBehavior ) { $ document -> setWorkflowStage ( WorkflowStage :: TEST ) ; } $ this -> indexDocument ( $ document ) ; if ( $ document instanceof WorkflowStageBehavi... | Indexes a document after its draft have been removed . |
10,934 | private function indexDocument ( $ document ) { if ( ! $ document instanceof StructureBehavior ) { return ; } if ( $ document instanceof SecurityBehavior && ! empty ( $ document -> getPermissions ( ) ) ) { return ; } $ this -> searchManager -> index ( $ document ) ; } | Index document in search implementation depending on the publish state . |
10,935 | public function deindexRemovedDocument ( RemoveEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof StructureBehavior ) { return ; } if ( ! $ document instanceof WorkflowStageBehavior ) { $ this -> searchManager -> deindex ( $ document ) ; } else { $ workflowStage = $ document -> get... | Schedules a document to be deindexed . |
10,936 | public function deindexUnpublishedDocument ( UnpublishEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof StructureBehavior ) { return ; } $ this -> searchManager -> deindex ( $ document ) ; } | Deindexes the document from the search index for the website . |
10,937 | public function redirectWebspaceAction ( Request $ request ) { @ trigger_error ( __METHOD__ . '() is deprecated since version 1.6 and will be removed in 2.0. Replaced by ExceptionListener::redirectPartialMatch.' , E_USER_DEPRECATED ) ; $ url = $ this -> resolveRedirectUrl ( $ request -> get ( 'redirect' ) , $ request -... | Creates a redirect for configured webspaces . |
10,938 | public function redirectToRouteAction ( Request $ request , $ route , $ permanent = false ) { if ( '' === $ route ) { throw new HttpException ( $ permanent ? 410 : 404 ) ; } $ attributes = array_merge ( $ request -> attributes -> get ( '_route_params' ) , $ request -> query -> all ( ) ) ; unset ( $ attributes [ 'route'... | Create a redirect response which uses a route to generate redirect . |
10,939 | protected function setBreadcrumbToCollection ( Collection $ collection , $ locale , $ breadcrumbEntities ) { $ breadcrumbApiEntities = [ ] ; foreach ( $ breadcrumbEntities as $ entity ) { $ breadcrumbApiEntities [ ] = $ this -> getApiEntity ( $ entity , $ locale ) ; } $ collection -> setBreadcrumb ( $ breadcrumbApiEnti... | Sets the given breadcrumb entities as breadcrum on the given collection . |
10,940 | protected function getApiEntity ( CollectionInterface $ entity , $ locale , $ entities = null , $ breadcrumbEntities = null ) { $ apiEntity = new Collection ( $ entity , $ locale ) ; $ children = null ; if ( null !== $ entities ) { $ children = [ ] ; foreach ( $ entities as $ possibleChild ) { if ( null !== ( $ parent ... | Prepare an api entity . |
10,941 | protected function getCurrentUser ( ) { if ( $ this -> tokenStorage && ( $ token = $ this -> tokenStorage -> getToken ( ) ) ) { $ user = $ token -> getUser ( ) ; if ( $ user instanceof UserInterface ) { return $ user ; } } return ; } | Returns the current user from the token storage . |
10,942 | public static function getValueFromXPath ( $ path , \ DOMXPath $ xpath , \ DomNode $ context = null , $ default = null ) { $ result = $ xpath -> query ( $ path , $ context ) ; if ( 0 === $ result -> length ) { return $ default ; } $ item = $ result -> item ( 0 ) ; if ( null === $ item ) { return $ default ; } return $ ... | Returns value of path . |
10,943 | public static function getBooleanValueFromXPath ( $ path , \ DOMXPath $ xpath , \ DomNode $ context = null , $ default = null ) { $ value = self :: getValueFromXPath ( $ path , $ xpath , $ context , $ default ) ; if ( null === $ value ) { return ; } return 'true' === $ value || true === $ value ; } | Returns boolean value of path . |
10,944 | public function renderSeoTags ( \ Twig_Environment $ twig , array $ seoExtension , array $ content , array $ urls , $ shadowBaseLocale ) { $ template = 'SuluWebsiteBundle:Extension:seo.html.twig' ; @ trigger_error ( sprintf ( 'This twig extension is deprecated and should not be used anymore, include the "%s".' , $ temp... | Renders the correct title of the current page . The correct title is either the title provided by the SEO extension or the title of the content if the SEO extension does not provide one . |
10,945 | private function getHeightWidth ( $ x , $ y , $ retina , $ forceRatio , $ size , $ mode ) { $ newWidth = $ x ; $ newHeight = $ y ; if ( $ retina ) { $ newWidth = $ x * 2 ; $ newHeight = $ y * 2 ; } if ( ! $ newHeight ) { $ newHeight = $ size -> getHeight ( ) / $ size -> getWidth ( ) * $ newWidth ; } if ( ! $ newWidth )... | Gets the height and width of the resulting image according to the given parameters . |
10,946 | private function matchCustomUrl ( $ url , PortalInformation $ portalInformation , Request $ request ) { $ webspace = $ portalInformation -> getWebspace ( ) ; $ routeDocument = $ this -> customUrlManager -> findRouteByUrl ( rawurldecode ( $ url ) , $ webspace -> getKey ( ) ) ; if ( ! $ routeDocument ) { return [ ] ; } e... | Matches given url to portal - information . |
10,947 | private function checkMimeTypeSupported ( $ mimeType ) { foreach ( $ this -> supportedMimeTypes as $ supportedMimeType ) { if ( fnmatch ( $ supportedMimeType , $ mimeType ) ) { return true ; } } return false ; } | Returns true if the given mime type is supported otherwise false . |
10,948 | public function setContact ( \ Sulu \ Bundle \ ContactBundle \ Entity \ ContactInterface $ contact ) { $ this -> contact = $ contact ; return $ this ; } | Set contact . |
10,949 | public function setEmailType ( \ Sulu \ Bundle \ ContactBundle \ Entity \ EmailType $ emailType ) { $ this -> emailType = $ emailType ; return $ this ; } | Set emailType . |
10,950 | public function handleDefaultLocale ( HydrateEvent $ event ) { if ( null === $ event -> getLocale ( ) ) { $ event -> setLocale ( $ this -> documentRegistry -> getDefaultLocale ( ) ) ; } } | Set the default locale for the hydration request . |
10,951 | public function handleDocumentFromRegistry ( HydrateEvent $ event ) { if ( $ event -> hasDocument ( ) ) { return ; } $ node = $ event -> getNode ( ) ; if ( ! $ this -> documentRegistry -> hasNode ( $ node , $ event -> getLocale ( ) ) ) { return ; } $ document = $ this -> documentRegistry -> getDocumentForNode ( $ node ... | If there is already a document for the node registered use that . |
10,952 | public function handleStopPropagationAndResetLocale ( HydrateEvent $ event ) { if ( ! $ event -> hasDocument ( ) ) { return ; } $ locale = $ event -> getLocale ( ) ; $ document = $ event -> getDocument ( ) ; $ options = $ event -> getOptions ( ) ; $ originalLocale = $ this -> documentRegistry -> getOriginalLocaleForDoc... | Stop propagation if the document is already loaded in the requested locale . |
10,953 | public function handleNodeFromRegistry ( $ event ) { if ( $ event -> hasNode ( ) ) { return ; } $ document = $ event -> getDocument ( ) ; if ( ! $ this -> documentRegistry -> hasDocument ( $ document ) ) { return ; } $ node = $ this -> documentRegistry -> getNodeForDocument ( $ document ) ; $ event -> setNode ( $ node ... | If the node for the persisted document is in the registry . |
10,954 | public function handleRemove ( RemoveEvent $ event ) { $ document = $ event -> getDocument ( ) ; $ this -> documentRegistry -> deregisterDocument ( $ document ) ; } | Deregister removed documents . |
10,955 | private function handleRegister ( AbstractMappingEvent $ event ) { $ node = $ event -> getNode ( ) ; $ locale = $ event -> getLocale ( ) ; if ( ! $ this -> documentRegistry -> hasNode ( $ node , $ locale ) ) { $ this -> documentRegistry -> registerDocument ( $ event -> getDocument ( ) , $ node , $ locale ) ; } } | Register the document . |
10,956 | public function doSetValue ( $ value ) { $ items = $ value ; if ( $ value instanceof PropertyValue ) { $ items = $ value -> getValue ( ) ; } if ( null == $ items ) { return ; } if ( array_keys ( $ items ) !== range ( 0 , count ( $ items ) - 1 ) ) { $ items = [ $ items ] ; } $ this -> properties = [ ] ; for ( $ i = 0 ; ... | Sub properties need to be referenced to the PropertyValue so that the real property is updated . |
10,957 | public function getValue ( ) { if ( count ( $ this -> properties ) < $ this -> getMinOccurs ( ) ) { for ( $ i = count ( $ this -> properties ) ; $ i < $ this -> getMinOccurs ( ) ; ++ $ i ) { $ this -> initProperties ( $ i , $ this -> getDefaultTypeName ( ) ) ; } } $ data = [ ] ; foreach ( $ this -> properties as $ type... | get value of sub properties . |
10,958 | private function defineRepositories ( array $ objects , ContainerBuilder $ container ) { foreach ( $ objects as $ object => $ services ) { if ( array_key_exists ( 'model' , $ services ) ) { $ repositoryDefinition = $ this -> getRepositoryDefinition ( $ object , $ services , $ container ) ; $ container -> setDefinition ... | Define repositories . |
10,959 | private function getRepositoryDefinition ( $ object , array $ services , ContainerBuilder $ container ) { $ repositoryKey = $ this -> getContainerKey ( 'repository' , $ object , '.class' ) ; $ repositoryClass = 'Sulu\Component\Persistence\Repository\ORM\EntityRepository' ; if ( $ container -> hasParameter ( $ repositor... | Get the repository service definition . |
10,960 | private function remapObjectParameters ( array $ objects , ContainerBuilder $ container ) { foreach ( $ objects as $ object => $ services ) { foreach ( $ services as $ service => $ class ) { $ container -> setParameter ( sprintf ( 'sulu.%s.%s.class' , $ service , $ object ) , $ class ) ; } } } | Remap object parameters . |
10,961 | public static function createFromString ( $ locale , $ format = self :: UNDERSCORE ) { $ delimiter = '-' ; if ( in_array ( $ format , [ self :: UNDERSCORE , self :: LCID ] ) ) { $ delimiter = '_' ; } $ parts = explode ( $ delimiter , $ locale ) ; $ localization = new self ( ) ; $ localization -> setLanguage ( strtolowe... | Create an instance of localization for given locale . |
10,962 | public function getLocalization ( $ delimiter = '_' ) { @ trigger_error ( __METHOD__ . '() is deprecated since version 1.2 and will be removed in 2.0. Use getLocale() instead.' , E_USER_DEPRECATED ) ; $ localization = $ this -> getLanguage ( ) ; if ( null != $ this -> getCountry ( ) ) { $ localization .= $ delimiter . ... | Returns the localization code which is a combination of the language and the country . |
10,963 | public function getLocale ( $ format = self :: UNDERSCORE ) { $ localization = strtolower ( $ this -> getLanguage ( ) ) ; if ( null != $ this -> getCountry ( ) ) { $ country = strtolower ( $ this -> getCountry ( ) ) ; $ delimiter = '-' ; switch ( $ format ) { case self :: UNDERSCORE : $ delimiter = '_' ; break ; case s... | Returns the localization code which is a combination of the language and the country in a specific format . |
10,964 | private function validate ( $ content , $ locale ) { $ validation = $ this -> markupParser -> validate ( $ content , $ locale ) ; $ regex = sprintf ( self :: INVALID_REGEX , $ this -> markupNamespace , $ this -> markupNamespace ) ; foreach ( $ validation as $ tag => $ state ) { if ( false === strpos ( $ tag , 'sulu-val... | Returns validated content . |
10,965 | public function convert ( $ data ) { if ( empty ( $ data ) ) { return [ ] ; } $ map = [ ] ; $ minDepth = 99 ; foreach ( $ data as $ item ) { $ path = rtrim ( '/root' . $ item [ 'path' ] , '/' ) ; $ map [ $ path ] = $ item ; $ parts = explode ( '/' , $ path ) ; $ parts = array_filter ( $ parts ) ; $ depth = count ( $ pa... | generate a tree of the given data with the path property . |
10,966 | private function explodeTree ( $ array , $ delimiter = '_' , $ baseval = false ) { if ( ! is_array ( $ array ) ) { return false ; } $ splitRE = '/' . preg_quote ( $ delimiter , '/' ) . '/' ; $ returnArr = [ ] ; foreach ( $ array as $ key => $ val ) { $ parts = preg_split ( $ splitRE , $ key , - 1 , PREG_SPLIT_NO_EMPTY ... | Explode any single - dimensional array into a full blown tree structure based on the delimiters found in it s keys . |
10,967 | public function handleRemove ( RemoveEvent $ event ) { $ document = $ event -> getDocument ( ) ; $ node = $ this -> documentRegistry -> getNodeForDocument ( $ document ) ; $ node -> remove ( ) ; } | Remove the given documents node from PHPCR session and optionally remove any references to the node . |
10,968 | protected function clearDestinationWebspace ( ) { $ homeDocument = $ this -> documentManager -> find ( $ this -> sessionManager -> getContentPath ( $ this -> webspaceKeyDestination ) ) ; foreach ( $ homeDocument -> getChildren ( ) as $ child ) { $ this -> output -> writeln ( '<info>Processing: </info>' . $ child -> get... | Removes all pages from given webspace . |
10,969 | protected function updateBlocksStructure ( array & $ structureArray , BlockMetadata $ property , $ localeSource , $ localeDestination ) { if ( ! array_key_exists ( $ property -> getName ( ) , $ structureArray ) || ! $ structureArray [ $ property -> getName ( ) ] ) { return ; } foreach ( $ structureArray [ $ property ->... | Process content type block . |
10,970 | protected function updateSmartContentStructure ( array & $ structureArray , PropertyMetadata $ property , $ localeSource , $ localeDestination ) { foreach ( $ property -> getParameters ( ) as $ parameter ) { if ( ! array_key_exists ( $ property -> getName ( ) , $ structureArray ) ) { continue ; } if ( 'provider' !== $ ... | Updates the smart content structure when the property dataSource is set and the target is in the same webspace . |
10,971 | protected function updatePageSelection ( array & $ structureArray , PropertyMetadata $ property , $ localeSource , $ localeDestination ) { if ( ! array_key_exists ( $ property -> getName ( ) , $ structureArray ) || ! $ structureArray [ $ property -> getName ( ) ] ) { return ; } foreach ( $ structureArray [ $ property -... | Updates references in structure for content type page_selection . |
10,972 | protected function updateSinglePageSelection ( array & $ structureArray , PropertyMetadata $ property , $ localeSource , $ localeDestination ) { if ( ! array_key_exists ( $ property -> getName ( ) , $ structureArray ) || ! $ structureArray [ $ property -> getName ( ) ] ) { return ; } $ targetDocumentDestination = $ thi... | Updates references in structure for content type single_page_selection . |
10,973 | public function getAction ( $ id ) { $ view = $ this -> responseGetById ( $ id , function ( $ id ) { return $ this -> getDoctrine ( ) -> getRepository ( self :: $ entityName ) -> find ( $ id ) ; } ) ; return $ this -> handleView ( $ view ) ; } | Shows a single position for the given id . |
10,974 | public function cgetAction ( ) { $ list = new CollectionRepresentation ( $ this -> getDoctrine ( ) -> getRepository ( self :: $ entityName ) -> findBy ( [ ] , [ 'position' => 'ASC' ] ) , self :: $ entityKey ) ; $ view = $ this -> view ( $ list , 200 ) ; return $ this -> handleView ( $ view ) ; } | lists all positions optional parameter flat calls listAction . |
10,975 | public function postAction ( Request $ request ) { $ name = $ request -> get ( 'position' ) ; try { if ( null == $ name ) { throw new RestException ( 'There is no position-name for the given name' ) ; } $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ position = new Position ( ) ; $ position -> setPosition ( $ na... | Creates a new position . |
10,976 | public function clear ( $ cache = null ) { if ( null !== $ cache ) { if ( ! array_key_exists ( $ cache , $ this -> caches ) ) { throw new CacheNotFoundException ( $ cache ) ; } $ this -> caches [ $ cache ] -> clear ( ) ; } else { foreach ( $ this -> caches as $ cache ) { $ cache -> clear ( ) ; } } } | Clear all or the given cache . |
10,977 | public function getConditions ( ) { $ conditions = $ this -> entity -> getConditions ( ) ; $ result = [ ] ; if ( $ conditions ) { foreach ( $ conditions as $ condition ) { $ result [ ] = new Condition ( $ condition , $ this -> locale ) ; } return $ result ; } return ; } | Get conditions . |
10,978 | public function getSelect ( ) { $ concat = null ; foreach ( $ this -> fieldDescriptors as $ fieldDescriptor ) { if ( null == $ concat ) { $ concat = $ fieldDescriptor -> getSelect ( ) ; } else { $ concat = 'CONCAT(' . $ concat . ', CONCAT(\'' . $ this -> glue . '\', ' . $ fieldDescriptor -> getSelect ( ) . '))' ; } } r... | Returns the select statement for this field without the alias . |
10,979 | public function getJoins ( ) { $ joins = [ ] ; foreach ( $ this -> fieldDescriptors as $ fieldDescriptor ) { $ joins = array_merge ( $ joins , $ fieldDescriptor -> getJoins ( ) ) ; } return $ joins ; } | Returns all the joins required for this field . |
10,980 | public function clearAction ( ) { if ( ! $ this -> checkLivePermissionForAllWebspaces ( ) ) { return new JsonResponse ( null , 403 ) ; } $ this -> get ( 'sulu_website.http_cache.clearer' ) -> clear ( ) ; return new JsonResponse ( null , 204 ) ; } | Clear the whole http_cache for website . |
10,981 | private function checkLivePermissionForAllWebspaces ( ) { foreach ( $ this -> get ( 'sulu_core.webspace.webspace_manager' ) -> getWebspaceCollection ( ) as $ webspace ) { $ context = PageAdmin :: SECURITY_CONTEXT_PREFIX . $ webspace -> getKey ( ) ; if ( ! $ this -> get ( 'sulu_security.security_checker' ) -> hasPermiss... | Check the permissions for all webspaces . Returns true if the user has live permission in all webspaces . |
10,982 | public function addDomain ( Domain $ domain ) { if ( $ this -> domains -> contains ( $ domain ) ) { return $ this ; } $ this -> domains [ ] = $ domain ; return $ this ; } | Add domain . |
10,983 | public function getDomains ( ) { if ( 0 === count ( $ this -> domains ) ) { return null ; } return $ this -> domains -> map ( function ( Domain $ domain ) { return $ domain -> getUrl ( ) ; } ) ; } | Get domains . |
10,984 | public function handleHydrate ( AbstractMappingEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof ShadowLocaleBehavior || ! $ event -> getOption ( 'load_shadow_content' ) ) { return ; } $ node = $ event -> getNode ( ) ; $ locale = $ this -> inspector -> getOriginalLocale ( $ docume... | Update the locale to the shadow locale if it is enabled . |
10,985 | public function handlePersistUpdateUrl ( PersistEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof ShadowLocaleBehavior ) { return ; } if ( ! $ document -> isShadowLocaleEnabled ( ) ) { return ; } $ node = $ event -> getNode ( ) ; $ structure = $ this -> inspector -> getStructureMe... | If this is a shadow document update the URL to that of the shadowed document . |
10,986 | public function getContentPath ( PathBehavior $ document ) { $ path = $ this -> getPath ( $ document ) ; $ webspaceKey = $ this -> getWebspace ( $ document ) ; return str_replace ( sprintf ( '/%s/%s/%s' , $ this -> pathSegmentRegistry -> getPathSegment ( 'base' ) , $ webspaceKey , $ this -> pathSegmentRegistry -> getPa... | Return the path of the document in relation to the content root . |
10,987 | public function getStructureMetadata ( StructureBehavior $ document ) { try { return $ this -> structureFactory -> getStructureMetadata ( $ this -> getMetadata ( $ document ) -> getAlias ( ) , $ document -> getStructureType ( ) ) ; } catch ( StructureTypeNotFoundException $ exception ) { return ; } } | Return the structure for the given StructureBehavior implementing document . |
10,988 | public function getLocalizationState ( $ document ) { if ( $ document instanceof ShadowLocaleBehavior ) { if ( true === $ document -> isShadowLocaleEnabled ( ) ) { return LocalizationState :: SHADOW ; } } $ originalLocale = $ document -> getOriginalLocale ( ) ; $ currentLocale = $ document -> getLocale ( ) ; if ( $ ori... | Return the localization state of the node . |
10,989 | public function getLocale ( $ document ) { if ( $ document instanceof LocaleBehavior ) { return $ document -> getLocale ( ) ; } if ( $ this -> documentRegistry -> hasDocument ( $ document ) ) { return $ this -> documentRegistry -> getLocaleForDocument ( $ document ) ; } return ; } | Return the locale for the given document or null if the document is not managed . |
10,990 | public function getLocales ( $ document ) { $ locales = [ ] ; $ node = $ this -> getNode ( $ document ) ; $ prefix = $ this -> namespaceRegistry -> getPrefix ( 'system_localized' ) ; foreach ( $ node -> getProperties ( ) as $ property ) { preg_match ( sprintf ( '/^%s:([a-zA-Z_]*?)-.*/' , $ prefix ) , $ property -> getN... | Return the concrete localizations for the given document . |
10,991 | public function getConcreteLocales ( $ document ) { $ locales = $ this -> getLocales ( $ document ) ; if ( $ document instanceof ShadowLocaleBehavior ) { $ locales = array_diff ( $ locales , array_keys ( $ this -> getShadowLocales ( $ document ) ) ) ; } return array_values ( $ locales ) ; } | Return locales which are not shadows . |
10,992 | public function getShadowLocales ( ShadowLocaleBehavior $ document ) { $ shadowLocales = [ ] ; $ locales = $ this -> getLocales ( $ document ) ; $ node = $ this -> getNode ( $ document ) ; foreach ( $ locales as $ locale ) { $ shadowEnabledName = $ this -> encoder -> localizedSystemName ( ShadowLocaleSubscriber :: SHAD... | Return the enabled shadow locales for the given document . |
10,993 | public function getPublishedLocales ( ShadowLocaleBehavior $ document ) { $ node = $ this -> getNode ( $ document ) ; $ locales = $ this -> getLocales ( $ document ) ; $ publishedLocales = [ ] ; foreach ( $ locales as $ locale ) { $ publishedPropertyName = $ this -> encoder -> localizedSystemName ( WorkflowStageSubscri... | Return the published locales for the given document . |
10,994 | public function getLocalizedUrlsForPage ( BasePageDocument $ page ) { $ localizedUrls = [ ] ; $ webspaceKey = $ this -> getWebspace ( $ page ) ; $ webspace = $ this -> webspaceManager -> findWebspaceByKey ( $ webspaceKey ) ; $ node = $ this -> getNode ( $ page ) ; $ structure = $ this -> getStructureMetadata ( $ page )... | Returns urls for given page for all locales in webspace . |
10,995 | public function postGenerateAction ( Request $ request ) { $ parentUuid = $ this -> getRequestParameter ( $ request , 'parent' ) ; $ parts = $ this -> getRequestParameter ( $ request , 'parts' , true ) ; $ templateKey = $ this -> getRequestParameter ( $ request , 'template' , true ) ; $ webspaceKey = $ this -> getReque... | return resource - locator for sub - node . |
10,996 | public function cgetAction ( $ id , Request $ request ) { list ( $ webspaceKey , $ languageCode ) = $ this -> getWebspaceAndLanguage ( $ request ) ; $ result = $ this -> getResourceLocatorRepository ( ) -> getHistory ( $ id , $ webspaceKey , $ languageCode ) ; return $ this -> handleView ( $ this -> view ( $ result ) )... | return all resource locators for given node . |
10,997 | public function cdeleteAction ( $ id , Request $ request ) { list ( $ webspaceKey , $ languageCode ) = $ this -> getWebspaceAndLanguage ( $ request ) ; $ path = $ this -> getRequestParameter ( $ request , 'ids' , true ) ; $ this -> getResourceLocatorRepository ( ) -> delete ( $ path , $ webspaceKey , $ languageCode ) ;... | deletes resource locator with given path . |
10,998 | private function getWebspaceAndLanguage ( Request $ request ) { $ webspaceKey = $ this -> getRequestParameter ( $ request , 'webspace' , true ) ; $ languageCode = $ this -> getRequestParameter ( $ request , 'language' , true ) ; return [ $ webspaceKey , $ languageCode ] ; } | returns webspacekey and languagecode . |
10,999 | private function generateNavigation ( $ contents , $ webspace , $ language , $ flat = false , $ context = null , $ breakOnNotInNavigation = false , $ recursive = true ) { $ result = [ ] ; foreach ( $ contents as $ content ) { if ( $ this -> inNavigation ( $ content , $ context ) ) { $ url = $ content -> getResourceLoca... | generate navigation items for given contents . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.