idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
20,000 | public function checksGroups ( array $ config ) { $ this -> writeln ( '<info>Updating groups and their rights.</info>' , OutputInterface :: VERBOSITY_VERBOSE ) ; foreach ( $ config as $ identifier => $ rights ) { $ group = $ this -> em -> getRepository ( Group :: class ) -> findOneBy ( [ '_name' => $ identifier ] ) ; i... | Checks for groups creates them if they don t exist . |
20,001 | private function updateRights ( Group $ group , array $ config ) { $ securityIdentity = new UserSecurityIdentity ( $ group -> getObjectIdentifier ( ) , Group :: class ) ; foreach ( $ config as $ object => $ rights ) { $ methodName = sprintf ( 'add%sRights' , ucfirst ( $ object ) ) ; if ( method_exists ( $ this , $ meth... | Updates rights associated to a group |
20,002 | private function addObjectRights ( $ classname , array $ config , UserSecurityIdentity $ securityIdentity , $ labelField = '_label' ) { $ rights = $ this -> getActionsOnResources ( $ config ) ; foreach ( ( array ) $ rights as $ resource => $ actions ) { if ( 'all' === $ resource ) { $ this -> addClassAcl ( $ classname ... | Adding rights on generic objects . |
20,003 | private function addBundlesRights ( array $ config , UserSecurityIdentity $ securityIdentity ) { $ rights = $ this -> getActionsOnResources ( $ config ) ; foreach ( ( array ) $ rights as $ resource => $ actions ) { if ( 'all' === $ resource ) { foreach ( $ this -> bbapp -> getBundles ( ) as $ bundle ) { $ this -> addOb... | Adding rights on AbstractBundle objects . |
20,004 | private function addContentsRights ( array $ config , UserSecurityIdentity $ securityIdentity ) { $ rights = $ this -> getActionsOnResources ( $ config ) ; foreach ( ( array ) $ rights as $ resource => $ actions ) { if ( 'all' === $ resource ) { $ this -> addClassAcl ( AbstractClassContent :: class , $ securityIdentity... | Adding rights on AbstractClassContent objects . |
20,005 | private function getActionsOnResources ( $ config ) { $ result = [ ] ; $ resources = ( array ) Collection :: get ( $ config , 'resources' , [ ] ) ; $ actions = ( array ) Collection :: get ( $ config , 'actions' , [ ] ) ; if ( ! isset ( $ actions [ 0 ] ) || ! is_array ( $ actions [ 0 ] ) ) { $ actions = [ $ actions ] ; ... | Format actions on resources . |
20,006 | private function addClassAcl ( $ className , UserSecurityIdentity $ securityIdentity , array $ rights ) { $ objectIdentity = new ObjectIdentity ( 'all' , $ className ) ; $ this -> addAcl ( $ objectIdentity , $ securityIdentity , $ rights ) ; } | Add rights to security group on whole instances of class . |
20,007 | private function addObjectAcl ( $ object , UserSecurityIdentity $ securityIdentity , array $ rights ) { $ objectIdentity = ObjectIdentity :: fromDomainObject ( $ object ) ; $ this -> addAcl ( $ objectIdentity , $ securityIdentity , $ rights ) ; } | Add rights to security group on one instance of object . |
20,008 | private function addAcl ( ObjectIdentity $ objectIdentity , UserSecurityIdentity $ securityIdentity , array $ rights ) { try { $ acl = $ this -> aclProvider -> createAcl ( $ objectIdentity ) ; } catch ( \ Exception $ e ) { $ acl = $ this -> aclProvider -> findAcl ( $ objectIdentity ) ; } $ builder = new MaskBuilder ( )... | Add rights to security group on object . |
20,009 | protected function write ( $ messages , $ newLine = false , $ verbosity = OutputInterface :: VERBOSITY_NORMAL ) { if ( $ verbosity <= $ this -> output -> getVerbosity ( ) ) { $ this -> output -> write ( $ messages ) ; if ( true === $ newLine ) { $ this -> output -> writeln ( '' ) ; } } } | Writes a message to the output |
20,010 | public static function getPathFromContent ( ElementFile $ content , $ folder_size = 3 ) { if ( null === $ content -> getUid ( ) || null === $ content -> originalname ) { throw new InvalidArgumentException ( 'Enable to compute path, the provided element file is not yet initialized' ) ; } $ folder = '' ; $ filename = $ c... | Returns the computed storage filename of an element file . |
20,011 | public static function getPathFromUid ( $ uid , $ originalname , $ folder_size = 3 , $ include_originalname = false ) { if ( false === is_string ( $ uid ) || true === empty ( $ uid ) ) { throw new InvalidArgumentException ( 'Enable to compute path, the provided uid is not a valid string' ) ; } $ folder = '' ; $ filenam... | Returns the computed storage filename base on an uid . |
20,012 | public static function resize ( $ source , $ dest , $ width , $ height ) { if ( false === extension_loaded ( 'gd' ) ) { throw new \ BackBee \ Exception \ BBException ( 'gd extension is required' ) ; } if ( false === is_readable ( $ source ) ) { throw new InvalidArgumentException ( 'Enable to read source file' ) ; } if ... | Resizes an image and saves it to the provided file path . |
20,013 | protected function initConnection ( $ input , $ output ) { if ( null !== $ input -> getOption ( 'host' ) ) { $ connection [ 'host' ] = $ input -> getOption ( 'host' ) ; } if ( null !== $ input -> getOption ( 'port' ) ) { $ connection [ 'port' ] = $ input -> getOption ( 'port' ) ; } if ( null !== $ input -> getOption ( ... | Initiate doctrine connection for the Command on master database if its configure |
20,014 | private function checkBeforeUpdate ( ) { if ( 0 <= version_compare ( BBApplication :: VERSION , '1.1' ) ) { $ schemaManager = $ this -> em -> getConnection ( ) -> getSchemaManager ( ) ; $ pageName = $ this -> em -> getClassMetadata ( 'BackBee\NestedNode\Page' ) -> getTableName ( ) ; $ sectionName = $ this -> em -> getC... | Checks the db if section feature is already available for version > 1 . 1 |
20,015 | protected function getUpdateQueries ( ) { $ schema = new SchemaTool ( $ this -> em ) ; $ metadatas = $ this -> em -> getMetadataFactory ( ) -> getAllMetadata ( ) ; $ this -> em -> getEventManager ( ) -> addEventListener ( Events :: onSchemaAlterTable , $ this ) ; $ sqls = $ schema -> getUpdateSchemaSql ( $ metadatas , ... | Get update queries . |
20,016 | private function updateMessage ( ) { $ this -> message = $ this -> _message ; if ( null !== $ this -> _source && null !== $ this -> _seek ) { $ this -> message .= sprintf ( ' in %s at %d.' , $ this -> _source , $ this -> _seek ) ; } elseif ( null !== $ this -> _source ) { $ this -> message .= sprintf ( ' : %s.' , $ thi... | Updates the error message according to the source and seek provided . |
20,017 | protected function _extractData ( $ data ) { $ extractedData = array ( ) ; foreach ( $ data as $ key => $ value ) { $ type = 'scalar' ; $ options = array ( ) ; if ( is_array ( $ value ) ) { if ( isset ( $ value [ 'type' ] ) ) { $ type = $ value [ 'type' ] ; if ( isset ( $ value [ 'default' ] ) ) { $ options [ 'default'... | Extract and format data from parser . |
20,018 | private function resolveFilePath ( $ path ) { $ path = str_replace ( array ( $ this -> _protocol . '://' , '/' ) , array ( '' , DIRECTORY_SEPARATOR ) , $ path ) ; foreach ( $ this -> _includeExtensions as $ ext ) { $ filename = $ path . $ ext ; File :: resolveFilepath ( $ filename , null , array ( 'include_path' => $ t... | Return the real yaml file path of the loading class . |
20,019 | public function stream_open ( $ path , $ mode , $ options , & $ opened_path ) { $ path = str_replace ( array ( $ this -> _protocol . '://' , '/' ) , array ( '' , DIRECTORY_SEPARATOR ) , $ path ) ; $ this -> classname = basename ( $ path ) ; if ( dirname ( $ path ) && dirname ( $ path ) != DIRECTORY_SEPARATOR ) { $ this... | Opens a stream content for a yaml file . |
20,020 | public function url_stat ( $ path , $ flag ) { $ path = str_replace ( array ( $ this -> _protocol . '://' , '/' ) , array ( '' , DIRECTORY_SEPARATOR ) , $ path ) ; $ this -> _path = $ this -> resolveFilePath ( $ path ) ; if ( is_file ( $ this -> _path ) && is_readable ( $ this -> _path ) ) { $ fd = fopen ( $ this -> _p... | Retrieve information about a yaml file . |
20,021 | public static function getOutput ( $ class , $ options = null ) { $ fakeClass = new $ class ( $ options ) ; $ generatorName = $ fakeClass -> generatedBy ( ) ; $ generator = new $ generatorName ( ) ; $ generator -> setCaller ( $ fakeClass ) ; return $ generator -> generate ( ) ; } | Returns a string output . |
20,022 | public function update ( AbstractClassContent $ content , array $ data ) { if ( ! isset ( $ data [ 'parameters' ] ) && ! isset ( $ data [ 'elements' ] ) ) { throw new \ InvalidArgumentException ( 'Provided data are not valids for ClassContentManager::update.' ) ; } if ( isset ( $ data [ 'parameters' ] ) ) { $ this -> u... | Updates the content whith provided data . |
20,023 | public function isMainZone ( $ content ) { if ( $ content instanceof ContentSet ) { $ pages = $ this -> entityManager -> getRepository ( 'BackBee\ClassContent\ContentSet' ) -> findPagesByContent ( $ content ) ; if ( count ( $ pages ) > 0 ) { foreach ( $ pages as $ page ) { if ( $ page instanceof Page ) { if ( false !==... | Check if a contentset is a main zone on a page |
20,024 | public function getAllClassContentClassnames ( ) { if ( null === $ this -> contentClassnames ) { $ cacheId = md5 ( 'all_classcontents_classnames_' . $ this -> app -> getContext ( ) . '_' . $ this -> app -> getEnvironment ( ) ) ; if ( ! $ this -> app -> isDebugMode ( ) && false !== $ value = $ this -> cache -> load ( $ ... | Returns all classcontents classnames |
20,025 | public function getAllElementClassContentClassnames ( ) { $ classnames = array_filter ( $ this -> getAllClassContentClassnames ( ) , function ( $ classname ) { return false !== strpos ( $ classname , AbstractClassContent :: CLASSCONTENT_BASE_NAMESPACE . 'Element\\' ) ; } ) ; $ classnames [ ] = AbstractClassContent :: C... | Returns classnames of all classcontents element |
20,026 | public function commit ( AbstractClassContent $ content , array $ data = [ ] ) { foreach ( $ this -> getAllClassContentClassnames ( ) as $ classname ) { class_exists ( $ classname ) ; } if ( null === $ draft = $ this -> getDraft ( $ content ) ) { throw new InvalidArgumentException ( sprintf ( '%s with identifier "%s" h... | Computes provided data to define what to commit from given content . |
20,027 | public function revert ( AbstractClassContent $ content , array $ data = [ ] ) { if ( 0 === count ( $ data ) ) { $ data [ 'parameters' ] = array_keys ( $ content -> getAllParams ( ) ) ; if ( $ content instanceof ContentSet ) { $ data [ 'elements' ] = true ; } else { $ data [ 'elements' ] = array_keys ( $ content -> get... | Computes provided data to define what to revert from given content . |
20,028 | public function revertToRevision ( AbstractClassContent $ content , $ revision ) { if ( null !== $ draft = $ this -> getDraft ( $ content ) ) { $ this -> entityManager -> remove ( $ draft ) ; } if ( $ content -> getRevision ( ) === ( int ) $ revision ) { return $ this ; } $ source = $ this -> entityManager -> getReposi... | Reverts a content to a specific revision . |
20,029 | private function updateElements ( AbstractClassContent $ content , array $ elementsData ) { if ( $ content instanceof ContentSet ) { $ elements = $ this -> prepareElements ( $ elementsData , false ) ; $ page = $ this -> isMainZone ( $ content ) ; $ this -> updateContentSetElements ( $ content , $ elements , $ page ) ; ... | Updates provided content s elements with data |
20,030 | private function updateContentSetElements ( ContentSet $ content , array $ elementsData , Page $ page = null ) { $ content -> clear ( ) ; foreach ( $ elementsData as $ data ) { if ( $ data instanceof AbstractClassContent ) { if ( null !== $ page && null === $ data -> getMainNode ( ) ) { $ data -> setMainNode ( $ page )... | Updates provided contentset s elements with data . |
20,031 | private function updateContentElements ( AbstractClassContent $ content , array $ elementsData ) { foreach ( $ elementsData as $ key => $ data ) { if ( in_array ( 'Element\Keyword' , $ content -> getAccept ( ) [ $ key ] ) ) { $ this -> entityManager -> getRepository ( 'BackBee\ClassContent\Element\Keyword' ) -> updateK... | Updates provided content s elements with data . |
20,032 | private function prepareElements ( array $ elementsData , $ acceptScalar = true ) { $ elements = [ ] ; foreach ( $ elementsData as $ key => $ data ) { if ( true === $ acceptScalar && is_scalar ( $ data ) ) { $ elements [ $ key ] = $ data ; continue ; } if ( ! is_array ( $ data ) ) { continue ; } if ( isset ( $ data [ '... | Prepare elements to be setted . |
20,033 | private function updateParameters ( AbstractClassContent $ content , array $ paramsData ) { foreach ( $ paramsData as $ key => $ param ) { $ content -> setParam ( $ key , $ param ) ; } return $ this ; } | Updates provided content s parameters . |
20,034 | private function prepareDraftForCommit ( AbstractClassContent $ content , Revision $ draft , array $ data ) { if ( $ content instanceof ContentSet ) { if ( ! isset ( $ data [ 'elements' ] ) || false === $ data [ 'elements' ] ) { $ draft -> clear ( ) ; foreach ( $ content -> getData ( ) as $ element ) { $ draft -> push ... | Prepares draft for commit . |
20,035 | private function executeCommit ( AbstractClassContent $ content , Revision $ draft ) { $ content -> setDraft ( null ) ; if ( $ content instanceof ContentSet ) { $ content -> clear ( ) ; while ( $ subcontent = $ draft -> next ( ) ) { if ( $ subcontent instanceof AbstractClassContent ) { $ subcontent = $ this -> entityMa... | Executes commit action on content and its draft . |
20,036 | private function commitPostProcess ( AbstractClassContent $ content , Revision $ draft ) { $ data = $ draft -> jsonSerialize ( ) ; if ( 0 !== count ( $ data [ 'parameters' ] ) && 0 !== count ( $ data [ 'elements' ] ) ) { $ draft -> setRevision ( $ content -> getRevision ( ) ) ; $ draft -> setState ( Revision :: STATE_M... | Runs process of post commit . |
20,037 | private function executeRevert ( AbstractClassContent $ content , Revision $ draft , array $ data ) { $ content -> setDraft ( null ) ; if ( $ content instanceof ContentSet ) { if ( isset ( $ data [ 'elements' ] ) && true === $ data [ 'elements' ] ) { $ draft -> clear ( ) ; foreach ( $ content -> getData ( ) as $ elemen... | Executes revert action on content and its draft . |
20,038 | private function revertPostProcess ( AbstractClassContent $ content , Revision $ draft ) { $ data = $ draft -> jsonSerialize ( ) ; if ( 0 === count ( $ data [ 'parameters' ] ) && ( 0 === count ( $ data [ 'elements' ] ) || ( $ content instanceof ContentSet && $ data [ 'elements' ] [ 'current' ] === $ data [ 'elements' ]... | Runs revert post action on content and its draft . |
20,039 | public function commitFile ( ElementFile $ file ) { $ filename = $ file -> path ; $ currentname = Media :: getPathFromContent ( $ file ) ; File :: resolveFilepath ( $ currentname , null , array ( 'base_dir' => $ this -> _mediadir ) ) ; try { if ( ! is_dir ( dirname ( $ currentname ) ) ) { mkdir ( dirname ( $ currentnam... | Move an temporary uploaded file to either media library or storage directory . |
20,040 | public function updateFile ( AbstractClassContent $ file , $ newfilename , $ originalname = null , $ src = null ) { if ( false === ( $ file instanceof ElementFile ) ) { throw new ClassContentException ( 'Invalid content type' ) ; } if ( null === $ originalname ) { $ originalname = $ file -> originalname ; } $ base_dir ... | Move an uploaded file to the temporary directory and update file content . |
20,041 | public function isInMediaLibrary ( ElementFile $ file ) { $ parent_ids = $ this -> getParentContentUid ( $ file ) ; if ( 0 === count ( $ parent_ids ) ) { return false ; } $ q = $ this -> _em -> getConnection ( ) -> createQueryBuilder ( ) -> select ( 'm.id' ) -> from ( 'media' , 'm' ) -> andWhere ( 'm.content_uid IN ("'... | Return true if file is in media libray false otherwise . |
20,042 | public function setDirectories ( BBApplication $ application = null ) { if ( null !== $ application ) { $ this -> _application = $ application ; $ this -> setTemporaryDir ( $ application -> getTemporaryDir ( ) ) -> setStorageDir ( $ application -> getStorageDir ( ) ) -> setMediaDir ( $ application -> getMediaDir ( ) ) ... | Set the storage directories define by the BB5 application . |
20,043 | private function dispatchPostUploadEvent ( $ sourcefile , $ targetfile ) { if ( null !== $ this -> _application && null !== $ this -> _application -> getEventDispatcher ( ) ) { $ event = new \ BackBee \ Event \ PostUploadEvent ( $ sourcefile , $ targetfile ) ; $ this -> _application -> getEventDispatcher ( ) -> dispatc... | Dispatch postupload event . |
20,044 | public function resourcesAction ( $ filename , $ base_dir = null ) { if ( null === $ base_dir ) { File :: resolveFilepath ( $ filename , null , array ( 'include_path' => $ this -> application -> getResourceDir ( ) ) ) ; } else { File :: resolveFilepath ( $ filename , null , array ( 'base_dir' => $ base_dir ) ) ; } $ th... | Handles a resource file request . |
20,045 | public function getClassContentThumbnailAction ( $ filename ) { $ base_folder = $ this -> application -> getContainer ( ) -> getParameter ( 'classcontent_thumbnail.base_folder' ) ; $ base_directories = array_map ( function ( $ directory ) use ( $ base_folder ) { return str_replace ( DIRECTORY_SEPARATOR . DIRECTORY_SEPA... | Hdandles classcontent thumbnail request returns the right thumbnail if it exists else the default one . |
20,046 | private function createResourceResponse ( $ filename ) { $ response = new Response ( ) ; $ filestats = stat ( $ filename ) ; $ response -> headers -> set ( 'Content-Type' , MimeType :: getInstance ( ) -> guess ( $ filename ) ) ; $ response -> headers -> set ( 'Content-Length' , $ filestats [ 'size' ] ) ; $ response -> ... | Create Response object for resource . |
20,047 | public static function dump ( $ string , $ color = null , $ debug = true ) { if ( $ debug ) { print self :: formatOutput ( $ string , $ color ) ; static :: flush ( ) ; } } | pring the string value directly . |
20,048 | public function findByCustomServerName ( $ server_name , array $ sites_config ) { $ site_label = null ; foreach ( $ sites_config as $ key => $ data ) { if ( $ server_name === $ data [ 'domain' ] ) { $ site_label = $ key ; break ; } } $ site = null ; if ( null !== $ site_label ) { $ site = $ this -> findOneBy ( array ( ... | Returns site entity according to custom server_name if it exists in sites_config . |
20,049 | public function getCategory ( $ v ) { $ v = $ this -> buildCategoryId ( $ v ) ; return isset ( $ this -> categories [ $ v ] ) ? $ this -> categories [ $ v ] : null ; } | Returns category by name or id . |
20,050 | private function loadCategoriesFromClassContentDirectories ( $ directories ) { $ classcontents = [ ] ; foreach ( $ directories as $ directory ) { $ classcontents = array_merge ( $ classcontents , self :: getClassContentClassnamesFromDir ( $ directory ) ) ; } foreach ( $ classcontents as $ class ) { try { if ( class_exi... | Parse classcontent directories and hydrate categories attribute . |
20,051 | public function logout ( Request $ request , Response $ response , TokenInterface $ token ) { $ this -> _authentication_provider -> clearNonce ( $ token ) ; } | Invalidate the current BB connection . |
20,052 | protected function resolveConst ( $ const , Page $ page = null ) { $ value = '' ; switch ( strtolower ( $ const ) ) { case 'url' : $ value = ( null !== $ page ) ? $ page -> getUrl ( ) : '' ; default : break ; } return $ value ; } | Resolves constant value . |
20,053 | private function getElementValue ( AbstractClassContent $ content , Page $ page ) { $ draft = $ this -> releaseDraft ( $ content ) ; if ( $ content instanceof File ) { $ value = $ content -> path ; } elseif ( $ content instanceof Keyword ) { $ value = $ this -> getKeyword ( $ content ) ; } else { $ value = trim ( str_r... | Returns value for Element content . |
20,054 | private function getArrayValue ( array $ array ) { $ value = [ ] ; foreach ( $ array as $ item ) { if ( $ item instanceof Keyword ) { $ item = $ this -> getKeyword ( $ item ) ; } $ value [ ] = trim ( str_replace ( array ( "\n" , "\r" ) , '' , strip_tags ( '' . $ item ) ) ) ; } array_walk ( $ value , function ( & $ item... | Returns value for array . |
20,055 | private function releaseDraft ( $ content ) { $ draft = null ; if ( $ content instanceof AbstractClassContent && ( null !== $ draft = $ content -> getDraft ( ) ) ) { $ content -> releaseDraft ( ) ; } return $ draft ; } | Release content draft and returns it . |
20,056 | private function setDefaultProperties ( $ uid = null , Section $ mainSection = null , $ title = null , $ url = null , $ target = self :: DEFAULT_TARGET ) { $ this -> _state = Page :: STATE_HIDDEN ; $ this -> _target = $ target ; $ this -> _created = new \ DateTime ( ) ; $ this -> _modified = new \ DateTime ( ) ; $ this... | Sets the default values to properties . |
20,057 | public function getUrl ( $ doRedirect = null ) { if ( null === $ doRedirect ) { $ doRedirect = $ this -> useUrlRedirect ; } if ( $ this -> isRedirect ( ) && $ doRedirect ) { return $ this -> getRedirect ( ) ; } return $ this -> _url ; } | Returns the URL of the page . |
20,058 | public function getNormalizeUri ( ) { if ( null === $ this -> getSite ( ) ) { return $ this -> getUrl ( ) ; } return $ this -> getUrl ( ) . $ this -> getSite ( ) -> getDefaultExtension ( ) ; } | Returns the URL with extension of the page . |
20,059 | public function isOnline ( $ ignoreSchedule = false ) { $ onlineByState = ( $ this -> getState ( ) & self :: STATE_ONLINE ) && ! ( $ this -> getState ( ) & self :: STATE_DELETED ) ; if ( true === $ ignoreSchedule ) { return $ onlineByState ; } else { return $ onlineByState && ( null === $ this -> getPublishing ( ) || 0... | Is the page online? |
20,060 | public function setLayout ( Layout $ layout , AbstractClassContent $ toPushInMainZone = null ) { $ this -> _layout = $ layout ; $ count = count ( ( array ) $ layout -> getZones ( ) ) ; for ( $ i = $ this -> getContentSet ( ) -> count ( ) ; $ i < $ count ; $ i ++ ) { if ( null === $ zone = $ layout -> getZone ( $ i ) ) ... | Sets the layout for the page . Adds as much ContentSet to the page main ContentSet than defined zones in layout . |
20,061 | public function setState ( $ state ) { $ state = ( int ) $ state ; if ( $ this -> isRoot ( ) && ! ( $ state & Page :: STATE_ONLINE ) ) { throw new \ LogicException ( "Root page state must be online." ) ; } if ( ! $ this -> isOnline ( ) && ( self :: STATE_ONLINE & $ state ) && ! $ this -> isRoot ( ) && ! $ this -> getPu... | Sets the state . |
20,062 | public function setPublishing ( $ publishing = null ) { if ( $ publishing === null ) { $ this -> _publishing = null ; } else { $ this -> _publishing = $ this -> validatePublishing ( $ publishing ) ; } return $ this ; } | Sets the publishing date . |
20,063 | private function validatePublishing ( $ publishing ) { if ( $ this -> isRoot ( ) && $ publishing !== null ) { throw new \ LogicException ( "Root page can't be scheduled published." ) ; } if ( ! ( $ publishing instanceof \ DateTime ) ) { $ publishing = $ this -> convertTimestampToDateTime ( $ publishing ) ; } return $ p... | Validate the publishing date . |
20,064 | public function setArchiving ( $ archiving = null ) { if ( $ archiving === null ) { $ this -> _archiving = null ; } else { $ this -> _archiving = $ this -> validateArchiving ( $ archiving ) ; } return $ this ; } | Sets the archiving date . |
20,065 | private function validateArchiving ( $ archiving ) { if ( $ this -> isRoot ( ) && $ archiving !== null ) { throw new \ LogicException ( "Root page can't be archived." ) ; } if ( ! ( $ archiving instanceof \ DateTime ) ) { $ archiving = $ this -> convertTimestampToDateTime ( $ archiving ) ; } if ( $ archiving -> getTime... | Validate the archiving date . |
20,066 | public function getInheritedContensetZoneParams ( ContentSet $ contentSet ) { $ zone = null ; if ( null === $ this -> getLayout ( ) || null === $ this -> getParent ( ) || false === is_array ( $ this -> getLayout ( ) -> getZones ( ) ) ) { return $ zone ; } $ layoutZones = $ this -> getLayout ( ) -> getZones ( ) ; $ coun... | Returns the inherited zone according to the provided ContentSet . |
20,067 | public function getParentZoneAtSamePositionIfExists ( ContentSet $ contentSet ) { $ indexOfContent = $ this -> getContentSet ( ) -> indexOfByUid ( $ contentSet , true ) ; if ( false === $ indexOfContent ) { return false ; } $ parent = $ this -> getParent ( ) ; if ( null === $ parent ) { return false ; } $ parentContent... | Returns the parent ContentSet in the same zone false if it is not found . |
20,068 | public function getInheritedZones ( $ uidOnly = false ) { $ inheritedZones = array ( ) ; $ uidOnly = ( isset ( $ uidOnly ) && is_bool ( $ uidOnly ) ) ? $ uidOnly : false ; if ( null !== $ this -> getParent ( ) ) { $ parentZones = $ this -> getParent ( ) -> getContentSet ( ) ; $ cPageRootZoneContainer = $ this -> getCon... | Tells which rootContentset is inherited from currentpage s parent . |
20,069 | public function getPageMainZones ( ) { $ result = array ( ) ; if ( null === $ this -> getLayout ( ) ) { return $ result ; } $ currentpageRootZones = $ this -> getContentSet ( ) ; $ layoutZones = $ this -> getLayout ( ) -> getZones ( ) ; $ count = count ( $ layoutZones ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ zo... | Returns the main zones of the page Page s mainzone can t be unlinked . |
20,070 | public function isLinkedToHisParentBy ( ContentSet $ contentset = null ) { if ( null !== $ contentset && true === array_key_exists ( $ contentset -> getUid ( ) , $ this -> getInheritedZones ( ) ) ) { return true ; } return false ; } | Is the ContentSet is linked to his parent . |
20,071 | public function replaceRootContentSet ( ContentSet $ contentToReplace , ContentSet $ newContentSet , $ checkContentsLinkToParent = true ) { $ checkContentsLinkToParent = ( true === $ checkContentsLinkToParent ) ; $ contentIsLinked = true === $ checkContentsLinkToParent ? $ this -> isLinkedToHisParentBy ( $ contentToRep... | Replaces the ContentSet of the page . |
20,072 | public static function getUndeletedStates ( ) { return array ( Page :: STATE_OFFLINE , Page :: STATE_ONLINE , Page :: STATE_HIDDEN , Page :: STATE_ONLINE + Page :: STATE_HIDDEN , ) ; } | Returns states except deleted . |
20,073 | public function hasChildrenVisible ( ) { foreach ( $ this -> getChildren ( ) as $ child ) { if ( $ child -> getState ( ) == static :: STATE_ONLINE ) { return true ; } } return false ; } | Looks for at least one online children . |
20,074 | public function getBreadcrumb ( Page $ page = null , $ breadcrumb = array ( ) ) { if ( null === $ this -> breadcrumb ) { $ page = ( null !== $ page ) ? $ page : $ this ; $ breadcrumb [ ] = $ page ; if ( null !== $ page -> getParent ( ) ) { return $ this -> getBreadcrumb ( $ page -> getParent ( ) , $ breadcrumb ) ; } el... | Returns an array of the ascendants . |
20,075 | public function getBreadcrumb_uids ( ) { $ breadcrumb_uids = array ( ) ; foreach ( $ this -> getBreadcrumb ( ) as $ page ) { $ breadcrumb_uids [ ] = $ page -> getUid ( ) ; } return array_reverse ( $ breadcrumb_uids ) ; } | Returns an array of the unique identifiers of the ascendants . |
20,076 | public function getStates ( ) { $ states = [ ] ; if ( self :: STATE_OFFLINE === $ this -> _state ) { $ states [ ] = self :: STATE_OFFLINE ; } elseif ( self :: STATE_HIDDEN === $ this -> _state ) { $ states [ ] = self :: STATE_OFFLINE ; $ states [ ] = self :: STATE_HIDDEN ; } else { foreach ( self :: $ STATES as $ value... | Returns available states . |
20,077 | public function getStateCode ( ) { $ code = $ this -> isOnline ( true ) ? '1' : '0' ; $ code .= null !== $ this -> _workflow_state ? '_' . $ this -> _workflow_state -> getCode ( ) : '' ; return $ code ; } | Returns the code of the workflow state . |
20,078 | private function convertTimestampToDateTime ( $ date ) { if ( false === ( $ date instanceof \ DateTime ) && false === is_int ( $ date ) ) { throw new InvalidArgumentException ( 'Page::convertTimestampToDateTime() expect date argument to be an integer or an instance of \DateTime' ) ; } elseif ( is_int ( $ date ) ) { $ d... | Convert provided date to DateTime . |
20,079 | private function createNewDefaultContent ( $ classname , $ mainzone = false ) { $ content = new $ classname ( ) ; if ( null !== $ content -> getProperty ( 'labelized-by' ) ) { try { $ label = $ content ; foreach ( explode ( '->' , ( string ) $ label -> getProperty ( 'labelized-by' ) ) as $ property ) { if ( is_object (... | Creates a new default content to be pushed in layout columns . |
20,080 | public function hasChildren ( $ ignoreDeleted = true ) { if ( $ ignoreDeleted ) { return $ this -> hasMainSection ( ) ? $ this -> getMainSection ( ) -> getHasChildren ( ) : false ; } return $ this -> hasMainSection ( ) ? $ this -> getMainSection ( ) -> hasChildren ( ) : false ; } | Has the page children? |
20,081 | public function setLevel ( $ level ) { if ( false === Numeric :: isPositiveInteger ( $ level , false ) ) { throw new InvalidArgumentException ( 'A nested level must be a positive integer.' ) ; } $ this -> _level = $ level ; return $ this ; } | Sets the level . |
20,082 | public function setMainSection ( Section $ section ) { if ( $ section === $ this -> _mainsection ) { return $ this ; } $ this -> _mainsection = $ section ; $ this -> _position = 0 ; $ this -> _level = $ section -> getLevel ( ) ; $ section -> setPage ( $ this ) ; return $ this -> setSection ( $ section ) ; } | Sets the main section for this page . |
20,083 | public function setSection ( Section $ section ) { if ( $ section !== $ this -> _mainsection ) { $ this -> _mainsection = null ; $ this -> _level = $ section -> getLevel ( ) + 1 ; if ( 0 === $ this -> _position ) { $ this -> _position = 1 ; } } $ this -> _section = $ section ; return $ this ; } | Sets the section for this page . |
20,084 | public function getSection ( ) { if ( null === $ this -> _section ) { $ this -> setSection ( new Section ( $ this -> getUid ( ) , array ( 'page' => $ this ) ) ) ; } return $ this -> _section ; } | Returns the section of this page . |
20,085 | public function isAncestorOf ( Page $ page , $ strict = true ) { if ( ! $ this -> hasMainSection ( ) ) { return ( $ this === $ page && false === $ strict ) ; } return $ this -> getSection ( ) -> isAncestorOf ( $ page -> getSection ( ) , $ strict ) || $ page -> getParent ( ) === $ this ; } | Is this page is an ancestor of the provided one? |
20,086 | public function isDescendantOf ( Page $ page , $ strict = true ) { if ( $ this === $ page ) { return ! $ strict ; } if ( ! $ this -> hasMainSection ( ) ) { return $ page === $ this -> getParent ( ) || $ this -> getSection ( ) -> isDescendantOf ( $ page -> getSection ( ) ) ; } return $ this -> getSection ( ) -> isDescen... | Is this page is a descendant of the provided one? |
20,087 | public function getRoot ( ) { if ( $ this -> getSection ( ) -> getRoot ( ) instanceof Section ) { return $ this -> getSection ( ) -> getRoot ( ) -> getPage ( ) ; } return null ; } | Returns the root page . |
20,088 | public function setRoot ( Page $ root ) { if ( $ this -> hasMainSection ( ) ) { $ this -> getMainSection ( ) -> setRoot ( $ root -> getRoot ( ) -> getMainSection ( ) ) ; } return $ this ; } | Sets the root node . |
20,089 | public function getParent ( ) { $ section = $ this -> getSection ( ) ; if ( $ this -> hasMainSection ( ) ) { if ( $ section -> isRoot ( ) ) { return null ; } elseif ( $ section -> getParent ( ) instanceof Section ) { return $ section -> getParent ( ) -> getPage ( ) ; } else { return null ; } } return $ section -> getPa... | Returns the parent page null if this page is root . |
20,090 | public static function onBeforeSave ( Event $ event ) { $ layout = $ event -> getTarget ( ) ; if ( ! is_a ( $ layout , 'BackBee\Site\Layout' ) ) { return ; } $ dispatcher = $ event -> getDispatcher ( ) ; if ( null !== $ dispatcher -> getApplication ( ) ) { if ( is_a ( $ event -> getEventArgs ( ) , 'Doctrine\ORM\Event\P... | Occur on site . layout . beforesave events . |
20,091 | public static function onAfterRemove ( Event $ event ) { $ layout = $ event -> getTarget ( ) ; if ( ! is_a ( $ layout , 'BackBee\Site\Layout' ) ) { return ; } $ dispatcher = $ event -> getDispatcher ( ) ; if ( null !== $ dispatcher -> getApplication ( ) ) { $ dispatcher -> getApplication ( ) -> getEntityManager ( ) -> ... | Occur on site . layout . postremove events . |
20,092 | public function setContainer ( ContainerInterface $ container = null ) { parent :: setContainer ( $ container ) ; if ( $ this -> getApplication ( ) ) { $ mediaClasses = $ this -> getApplication ( ) -> getAutoloader ( ) -> glob ( 'Media' . DIRECTORY_SEPARATOR . '*' ) ; foreach ( $ mediaClasses as $ mediaClass ) { class_... | Creates an instance of MediaController . |
20,093 | public function putAction ( $ id , Request $ request ) { $ mediaTitle = $ request -> get ( 'title' , 'Untitled media' ) ; $ mediaFolderUid = $ request -> get ( 'media_folder' , null ) ; $ media = $ this -> getMediaRepository ( ) -> find ( $ id ) ; $ currentMediaFoldierUid = $ media -> getMediaFolder ( ) -> getUid ( ) ;... | Update media content s and folder |
20,094 | public function postAction ( Request $ request ) { $ contentUid = $ request -> request -> get ( 'content_uid' ) ; $ contentType = $ request -> request -> get ( 'content_type' , null ) ; $ mediaFolderUid = $ request -> request -> get ( 'folder_uid' , null ) ; $ mediaTitle = $ request -> request -> get ( 'title' , 'Untit... | Post a new media . |
20,095 | private function getClassContentManager ( ) { $ manager = $ this -> getApplication ( ) -> getContainer ( ) -> get ( 'classcontent.manager' ) -> setBBUserToken ( $ this -> getApplication ( ) -> getBBUserToken ( ) ) ; return $ manager ; } | Get class content manager . |
20,096 | private function mediaToJson ( $ collection ) { $ result = [ ] ; foreach ( $ collection as $ media ) { $ content = $ media -> getContent ( ) ; if ( null !== $ draft = $ this -> getClassContentManager ( ) -> getDraft ( $ content ) ) { $ content -> setDraft ( $ draft ) ; } foreach ( $ content -> getData ( ) as $ element ... | Generate json . |
20,097 | private function addRangeToContent ( Response $ response , $ collection , $ offset , $ limit ) { $ total = "*" ; if ( $ collection instanceof Paginator ) { $ total = count ( $ collection ) ; } $ lastResult = $ offset + $ limit - 1 ; $ lastResult = $ lastResult < 0 ? 0 : $ lastResult ; $ response -> headers -> set ( 'Co... | Add range to content . |
20,098 | private function getClassicCollection ( Request $ request , $ mediaFolder , $ start , $ count ) { $ params = $ request -> query -> all ( ) ; $ contentType = $ request -> get ( 'contentType' , null ) ; if ( null !== $ contentType ) { try { $ params [ 'contentType' ] = AbstractClassContent :: getClassnameByContentType ( ... | Get classic collection . |
20,099 | private function getCollectionByContent ( $ contentUid , MediaFolder $ mediaFolder ) { $ content = $ this -> getEntityManager ( ) -> find ( 'BackBee\ClassContent\AbstractClassContent' , $ contentUid ) ; if ( null === $ content ) { throw new NotFoundHttpException ( "No content find with uid '{$contentUid}'" ) ; } return... | Get collection by content . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.