idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
10,100 | public static function add ( $ btsHandle , $ btsName , $ pkg = false ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ pkgID = ( int ) ( is_object ( $ pkg ) ? $ pkg -> getPackageID ( ) : $ pkg ) ; $ displayOrder = $ db -> fetchColumn ( 'select max(btsDisplayOrder) fr... | Create a new block type set . |
10,101 | public static function exportList ( $ xml ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ bxml = $ xml -> addChild ( 'blocktypesets' ) ; $ rs = $ db -> executeQuery ( 'select btsID from BlockTypeSets order by btsID asc' ) ; while ( ( $ btsID = $ rs -> fetchColumn (... | Export all the block type sets to a SimpleXMLElement element . |
10,102 | public static function getUnassignedBlockTypes ( $ includeInternalBlockTypes = false ) { $ result = [ ] ; $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ rs = $ db -> executeQuery ( <<<EOTselect BlockTypes.btIDfrom BlockTypesleft join BlockTypeSetBlockTypes on BlockTyp... | Get the list of block types that don t belong to any block type set . |
10,103 | public function getPackageHandle ( ) { $ pkgID = $ this -> getPackageID ( ) ; return empty ( $ pkgID ) ? false : PackageList :: getHandle ( $ pkgID ) ; } | Get the handle of the package that defined this set . |
10,104 | public function updateBlockTypeSetName ( $ btsName ) { $ btsName = ( string ) $ btsName ; $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ db -> update ( 'BlockTypeSets' , [ 'btsName' => $ btsName ] , [ 'btsID' => $ this -> getBlockTypeSetID ( ) ] ) ; $ this -> btsName ... | Update the name of this set . |
10,105 | public function updateBlockTypeSetHandle ( $ btsHandle ) { $ btsHandle = ( string ) $ btsHandle ; $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ db -> update ( 'BlockTypeSets' , [ 'btsHandle' => $ btsHandle ] , [ 'btsID' => $ this -> getBlockTypeSetID ( ) ] ) ; $ this... | Update the handle of this set . |
10,106 | public function updateBlockTypeSetDisplayOrder ( $ displayOrder ) { $ displayOrder = ( string ) $ displayOrder ; $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ db -> update ( 'BlockTypeSets' , [ 'btsDisplayOrder' => $ displayOrder ] , [ 'btsID' => $ this -> getBlockTy... | Update the display order of this set . |
10,107 | public function addBlockType ( BlockTypeEntity $ bt ) { if ( ! $ this -> contains ( $ bt ) ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ displayOrder = $ db -> fetchColumn ( 'select max(displayOrder) from BlockTypeSetBlockTypes where btsID = ?' , [ $ this -> getB... | Associate a block type to this set . |
10,108 | public function setBlockTypeDisplayOrder ( BlockTypeEntity $ bt , $ displayOrder ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ db -> update ( 'BlockTypeSetBlockTypes' , [ 'displayOrder' => $ displayOrder ] , [ 'btID' => $ bt -> getBlockTypeID ( ) , 'btsID' => $ t... | Update the display order of a block type contained in this set . |
10,109 | public function clearBlockTypes ( ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ db -> delete ( 'BlockTypeSetBlockTypes' , [ 'btsID' => $ this -> getBlockTypeSetID ( ) ] ) ; } | Disassociate all the block types currently associated to this set . |
10,110 | public function deleteKey ( $ bt ) { $ btID = ( int ) ( is_object ( $ bt ) ? $ bt -> getBlockTypeID ( ) : $ bt ) ; if ( $ btID !== 0 ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ db -> delete ( 'BlockTypeSetBlockTypes' , [ 'btsID' => $ this -> getBlockTypeSetID (... | Dissociate a specific block type currently associated to this set . |
10,111 | public function export ( $ axml ) { $ bset = $ axml -> addChild ( 'blocktypeset' ) ; $ bset -> addAttribute ( 'handle' , $ this -> getBlockTypeSetHandle ( ) ) ; $ bset -> addAttribute ( 'name' , $ this -> getBlockTypeSetName ( ) ) ; $ bset -> addAttribute ( 'package' , $ this -> getPackageHandle ( ) ) ; $ types = $ thi... | Export this set to a SimpleXMLElement element . |
10,112 | public function getBlockTypes ( ) { $ result = [ ] ; $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ rs = $ db -> executeQuery ( 'select btID from BlockTypeSetBlockTypes where btsID = ? order by displayOrder asc' , [ $ this -> getBlockTypeSetID ( ) ] ) ; while ( ( $ bt... | Get the list of block types associated to this set . |
10,113 | public function contains ( $ bt ) { $ result = false ; $ btID = ( int ) ( is_object ( $ bt ) ? $ bt -> getBlockTypeID ( ) : $ bt ) ; if ( $ btID !== 0 ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ result = $ db -> fetchColumn ( 'select btID from BlockTypeSetBlock... | Does this set contain a block type? |
10,114 | public function delete ( ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ db -> delete ( 'BlockTypeSetBlockTypes' , [ 'btsID' => $ this -> getBlockTypeSetID ( ) ] ) ; $ db -> delete ( 'BlockTypeSets' , [ 'btsID' => $ this -> getBlockTypeSetID ( ) ] ) ; } | Delete this set . |
10,115 | protected function rescanDisplayOrder ( ) { $ displayOrder = 0 ; $ btsID = $ this -> getBlockTypeSetID ( ) ; $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ rs = $ db -> executeQuery ( 'select btID from BlockTypeSetBlockTypes where btsID = ? order by displayOrder asc' ... | Regenereate the display order values of the block types associated to this set . |
10,116 | protected function getDefaultMessageFilter ( ) { $ filter = 'all' ; $ db = \ Database :: get ( ) ; $ count = $ db -> GetOne ( 'select count(cpa.paID) from ConversationPermissionAssignments cpa inner join PermissionAccess pa on cpa.paID = pa.paID inner join ConversationPermissionAddMessageAccessLis... | Returns default message filter for search interface . We default to all UNLESS we have at least one access entity that publishes its messages and has them be unapproved . If that s the case then we default to unapproved . |
10,117 | public function getPageCanonicalURL ( $ page , $ querystring = null ) { $ result = null ; if ( $ page ) { if ( $ this -> valn -> integer ( $ page , 1 ) ) { $ page = Page :: getByID ( $ page ) ; } if ( $ page instanceof Page && ! $ page -> isError ( ) ) { $ cID = $ page -> getCollectionID ( ) ; $ originalCID = $ page ->... | Generate the canonical URL of a page . |
10,118 | public function getStaticValues ( array $ cells ) { $ result = [ ] ; foreach ( $ this -> fieldsMap as $ cellIndex => $ info ) { if ( $ info [ 'kind' ] === 'staticHeader' ) { $ fieldName = $ info [ 'staticHeaderName' ] ; $ result [ $ fieldName ] = isset ( $ cells [ $ cellIndex ] ) ? $ cells [ $ cellIndex ] : '' ; } } re... | Get the values of the cells associated to the static headers . |
10,119 | public function getAttributesValues ( array $ cells ) { $ result = [ ] ; foreach ( $ this -> fieldsMap as $ cellIndex => $ info ) { switch ( $ info [ 'kind' ] ) { case 'singleAttributeHeader' : $ attributeIndex = $ info [ 'attributeIndex' ] ; $ result [ $ attributeIndex ] = isset ( $ cells [ $ cellIndex ] ) ? $ cells [... | Get the values of the cells associated to the attributes . |
10,120 | public function getLevelIcon ( ) { switch ( $ this -> getLevel ( ) ) { case Monolog :: EMERGENCY : return '<i class="text-danger fa fa-fire launch-tooltip" title="' . $ this -> getLevelDisplayName ( ) . '"></i>' ; case Monolog :: CRITICAL : case Monolog :: ALERT : return '<i class="text-danger fa fa-exclamation-circle ... | Gets the HTML code for the icon of the logging level . |
10,121 | public function getUserObject ( ) { if ( $ this -> getUserID ( ) ) { $ u = User :: getByUserID ( $ this -> getUserID ( ) ) ; if ( is_object ( $ u ) ) { return $ u ; } } } | Gets the user object of the user that caused the log . |
10,122 | public function getDisplayTimestamp ( ) { $ app = Application :: getFacadeApplication ( ) ; $ dh = $ app -> make ( 'helper/date' ) ; return $ dh -> formatDateTime ( $ this -> time , true , true ) ; } | Gets the formatted time of the log timestamp . |
10,123 | public static function getByID ( $ logID ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( 'database' ) -> connection ( ) ; $ row = $ db -> fetchAssoc ( 'select * from Logs where logID = ?' , [ $ logID ] ) ; if ( $ row ) { $ obj = new static ( ) ; $ obj = array_to_object ( $ obj , $ row ) ; r... | Gets the log object from its id . |
10,124 | public function delete ( ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( 'database' ) -> connection ( ) ; $ logID = $ this -> getID ( ) ; if ( ! empty ( $ logID ) ) { $ db -> delete ( 'Logs' , [ 'logID' => $ logID ] ) ; } } | Deletes the log entry . |
10,125 | public function hasFiles ( ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( 'database' ) ; $ fIDs = $ db -> fetchColumn ( 'SELECT fID FROM Files WHERE fslID = ?' , [ $ this -> getID ( ) ] ) ; return ( ! empty ( $ fIDs ) ) ; } | Check if the storage location contains files |
10,126 | protected function attemptAuthentication ( ) { $ extractor = $ this -> getExtractor ( ) ; if ( ! $ this -> isValid ( ) ) { throw new Exception ( 'Invalid account, user cannot be logged in.' ) ; } $ user_id = $ this -> getBoundUserID ( $ extractor -> getUniqueId ( ) ) ; if ( $ user_id && $ user_id > 0 ) { $ user = User ... | We now check if the user allows access to email address as twitter does not provide this and users can deny access to on facebook ) . |
10,127 | public function getBindingForUser ( $ user ) { $ result = null ; if ( is_object ( $ user ) ) { $ userID = $ user -> getUserID ( ) ; } else { $ userID = ( int ) $ user ; } if ( $ userID ) { $ db = $ this -> app -> make ( Connection :: class ) ; $ qb = $ db -> createQueryBuilder ( ) ; $ qb -> select ( 'oum.binding' ) -> ... | Get the binding associated to a specific user . |
10,128 | public function authorize ( ) { $ response = new Response ( ) ; try { $ request = $ this -> getAuthorizationRequest ( ) ; $ step = $ this -> determineStep ( $ request ) ; if ( $ step === self :: STEP_LOGIN ) { if ( ! $ this -> user ) { return $ this -> handleLogin ( $ request ) ; } $ userEntity = $ this -> entityManage... | Route handler that deals with authorization |
10,129 | public function handleLogin ( AuthorizationRequest $ request ) { $ error = new ErrorList ( ) ; $ emailLogin = $ this -> config -> get ( 'concrete.user.registration.email_registration' ) ; while ( $ this -> request -> getMethod ( ) === 'POST' ) { if ( ! $ this -> token -> validate ( 'oauth_login_' . $ request -> getClie... | Handle the login portion of an authorization request This method renders a view for login that handles either email or username based login |
10,130 | public function handleAuthorizeClient ( AuthorizationRequest $ request ) { $ error = new ErrorList ( ) ; $ client = $ request -> getClient ( ) ; while ( $ this -> request -> getMethod ( ) === 'POST' ) { if ( ! $ this -> token -> validate ( 'oauth_authorize_' . $ client -> getClientKey ( ) ) ) { $ error -> add ( $ this ... | Handle the scope authorization portion of an authorization request This method renders a view that outputs a list of scopes and asks the user to verify that they want to give the client the access that is being requested . |
10,131 | private function pruneTokens ( ) { $ now = new \ DateTime ( 'now' ) ; $ qb = $ this -> entityManager -> createQueryBuilder ( ) ; $ items = $ qb -> select ( 'token' ) -> from ( AccessToken :: class , 'token' ) -> where ( $ qb -> expr ( ) -> lt ( 'token.expiryDateTime' , ':now' ) ) -> getQuery ( ) -> execute ( [ ':now' =... | Prune old authentication tokens |
10,132 | private function pruneResults ( $ results ) { $ buffer = [ ] ; foreach ( $ results as $ item ) { $ buffer [ ] = $ item ; if ( count ( $ buffer ) > 50 ) { $ this -> clearTokenBuffer ( $ buffer ) ; $ buffer = [ ] ; } } $ this -> clearTokenBuffer ( $ buffer ) ; } | Loop over a list of results and prune them |
10,133 | private function clearTokenBuffer ( array $ buffer ) { foreach ( $ buffer as $ bufferItem ) { if ( $ bufferItem instanceof AccessToken ) { $ refreshToken = $ this -> entityManager -> getRepository ( RefreshToken :: class ) -> findOneByAccessToken ( $ bufferItem ) ; if ( $ refreshToken ) { $ this -> entityManager -> rem... | Remove items in a buffer from the entity manager |
10,134 | private function getConsentType ( AuthorizationRequest $ request ) { $ client = $ request -> getClient ( ) ; return $ client instanceof Client ? $ client -> getConsentType ( ) : Client :: CONSENT_SIMPLE ; } | Get the consent type associated with the current request |
10,135 | private function storeRequest ( AuthorizationRequest $ request ) { $ data = [ 'user' => $ request -> getUser ( ) ? $ request -> getUser ( ) -> getIdentifier ( ) : null , 'client' => $ request -> getClient ( ) -> getIdentifier ( ) , 'challenge' => $ request -> getCodeChallenge ( ) , 'challenge_method' => $ request -> ge... | Store a request against session |
10,136 | private function restoreRequest ( array $ data ) { if ( ! $ data ) { return null ; } $ scopeData = ( array ) array_get ( $ data , 'scopes' , [ ] ) ; $ scopes = array_filter ( array_map ( [ $ this , 'inflateType' ] , $ scopeData ) ) ; $ user = $ this -> inflateType ( array_get ( $ data , 'user' ) , User :: class ) ; $ c... | Restore a real request from the passed data |
10,137 | private function clearRequest ( AuthorizationRequest $ request ) { $ client = $ request -> getClient ( ) ; $ clientId = $ client -> getClientKey ( ) ; $ this -> session -> remove ( "authn_request.$clientId" ) ; } | Remove all session data related to this flow |
10,138 | private function inflateType ( $ identifier , $ type = Scope :: class ) { if ( $ identifier === null ) { return null ; } return $ this -> entityManager -> find ( $ type , $ identifier ) ; } | Inflate an identifier into a specific type |
10,139 | private function determineStep ( AuthorizationRequest $ request ) { if ( ! $ request -> getUser ( ) ) { return self :: STEP_LOGIN ; } if ( ! $ request -> isAuthorizationApproved ( ) ) { return self :: STEP_AUTHORIZE_CLIENT ; } return self :: STEP_COMPLETE ; } | Figure out what step we should be rendering based on the active authorization request This method should handle verifying authorization and login |
10,140 | private function createLoginView ( array $ data ) { $ consentType = $ this -> getConsentType ( $ this -> getAuthorizationRequest ( ) ) ; switch ( $ consentType ) { case Client :: CONSENT_NONE : break ; case Client :: CONSENT_SIMPLE : default : $ data [ 'consentView' ] = new View ( '/oauth/consent/simple' ) ; break ; } ... | Create a new authorize login view with the given data in scope |
10,141 | public function activate ( ) { $ db = Loader :: db ( ) ; self :: deactivateAll ( ) ; $ db -> Execute ( 'update SystemAntispamLibraries set saslIsActive = 1 where saslHandle = ?' , array ( $ this -> saslHandle ) ) ; } | Activate an Antispam library . |
10,142 | public function has ( $ name ) { if ( in_array ( $ name , $ this -> responseCookies -> getClearedCookies ( ) , true ) ) { return false ; } return $ this -> request -> cookies -> has ( $ name ) || $ this -> responseCookies -> hasCookie ( $ name ) ; } | Does a cookie exist in the request or response cookies? |
10,143 | public static function getByID ( $ gID ) { $ db = Database :: connection ( ) ; $ g = CacheLocal :: getEntry ( 'group' , $ gID ) ; if ( is_object ( $ g ) ) { return $ g ; } $ row = $ db -> fetchAssoc ( 'select * from ' . $ db -> getDatabasePlatform ( ) -> quoteSingleIdentifier ( 'Groups' ) . ' where gID = ?' , [ $ gID ]... | Takes the numeric id of a group and returns a group object . |
10,144 | public static function getByName ( $ gName ) { $ db = Database :: connection ( ) ; $ row = $ db -> fetchAssoc ( 'select * from ' . $ db -> getDatabasePlatform ( ) -> quoteSingleIdentifier ( 'Groups' ) . ' where gName = ?' , [ $ gName ] ) ; if ( $ row ) { $ g = new static ( ) ; $ g -> setPropertiesFromArray ( $ row ) ; ... | Takes the name of a group and returns a group object . |
10,145 | public static function getByPath ( $ path , $ version = 'RECENT' , TreeInterface $ tree = null ) { $ path = rtrim ( $ path , '/' ) ; $ cache = \ Core :: make ( 'cache/request' ) ; if ( $ tree ) { $ item = $ cache -> getItem ( sprintf ( 'site/page/path/%s/%s' , $ tree -> getSiteTreeID ( ) , trim ( $ path , '/' ) ) ) ; $... | Get a page given its path . |
10,146 | protected function populatePage ( $ cInfo , $ where , $ cvID ) { $ db = Database :: connection ( ) ; $ q0 = 'select Pages.cID, Pages.pkgID, Pages.siteTreeID, Pages.cPointerID, Pages.cPointerExternalLink, Pages.cIsDraft, Pages.cIsActive, Pages.cIsSystemPage, Pages.cPointerExternalLinkNewWindow, Pages.cFilename, Pages.pt... | Read the data from the database . |
10,147 | public function isEditMode ( ) { if ( $ this -> getCollectionPath ( ) == STACKS_LISTING_PAGE_PATH ) { return true ; } if ( $ this -> getPageTypeHandle ( ) == STACKS_PAGE_TYPE ) { return true ; } return $ this -> isCheckedOutByMe ( ) ; } | Is the page in edit mode? |
10,148 | public function getPackageHandle ( ) { if ( ! isset ( $ this -> pkgHandle ) ) { $ this -> pkgHandle = PackageList :: getHandle ( $ this -> pkgID ) ; } return $ this -> pkgHandle ; } | Get the handle the the package that added this page . |
10,149 | public function forceCheckIn ( ) { $ db = Database :: connection ( ) ; $ q = 'update Pages set cIsCheckedOut = 0, cCheckedOutUID = null, cCheckedOutDatetime = null, cCheckedOutDatetimeLastEdit = null where cID = ?' ; $ db -> executeQuery ( $ q , [ $ this -> cID ] ) ; } | Forces the page to be checked in if its checked out . |
10,150 | public static function getFromRequest ( Request $ request ) { $ c = $ request -> getCurrentPage ( ) ; if ( is_object ( $ c ) ) { return $ c ; } if ( $ request -> getPath ( ) != '' ) { $ path = $ request -> getPath ( ) ; $ db = Database :: connection ( ) ; $ cID = false ; $ ppIsCanonical = false ; $ site = \ Core :: mak... | Uses a Request object to determine which page to load . Queries by path and then by cID . |
10,151 | public function processArrangement ( $ area_id , $ moved_block_id , $ block_order ) { $ area_handle = Area :: getAreaHandleFromID ( $ area_id ) ; $ db = Database :: connection ( ) ; $ db -> executeQuery ( 'UPDATE CollectionVersionBlockStyles SET arHandle = ? WHERE cID = ? and cvID = ? and bID = ?' , [ $ area_handle , ... | Persist the data associated to a block when it has been moved around in the page . |
10,152 | public function isCheckedOut ( ) { $ db = Database :: connection ( ) ; if ( isset ( $ this -> isCheckedOutCache ) ) { return $ this -> isCheckedOutCache ; } $ q = "select cIsCheckedOut, cCheckedOutDatetimeLastEdit from Pages where cID = '{$this->cID}'" ; $ r = $ db -> executeQuery ( $ q ) ; if ( $ r ) { $ row = $ r -> ... | Is the page checked out? |
10,153 | public function getCollectionCheckedOutUserName ( ) { $ db = Database :: connection ( ) ; $ query = 'select cCheckedOutUID from Pages where cID = ?' ; $ vals = [ $ this -> cID ] ; $ checkedOutId = $ db -> fetchColumn ( $ query , $ vals ) ; if ( is_object ( UserInfo :: getByID ( $ checkedOutId ) ) ) { $ ui = UserInfo ::... | Gets the user that is editing the current page . |
10,154 | public static function getDraftsParentPage ( Site $ site = null ) { $ db = Database :: connection ( ) ; $ site = $ site ? $ site : \ Core :: make ( 'site' ) -> getSite ( ) ; $ cParentID = $ db -> fetchColumn ( 'select p.cID from PagePaths pp inner join Pages p on pp.cID = p.cID inner join SiteLocales sl on p.siteTreeID... | Get the drafts parent page for a specific site . |
10,155 | public static function getDrafts ( Site $ site ) { $ db = Database :: connection ( ) ; $ nc = self :: getDraftsParentPage ( $ site ) ; $ r = $ db -> executeQuery ( 'select Pages.cID from Pages inner join Collections c on Pages.cID = c.cID where cParentID = ? order by cDateAdded desc' , [ $ nc -> getCollectionID ( ) ] )... | Get the list of draft pages in a specific site . |
10,156 | public function populateRecursivePages ( $ pages , $ pageRow , $ cParentID , $ level , $ includeThisPage = true ) { $ db = Database :: connection ( ) ; $ children = $ db -> GetAll ( 'select cID, cDisplayOrder from Pages where cParentID = ? order by cDisplayOrder asc' , [ $ pageRow [ 'cID' ] ] ) ; if ( $ includeThisPage... | Create an array containing data about child pages . |
10,157 | public function queueForDuplicationSort ( $ a , $ b ) { if ( $ a [ 'level' ] > $ b [ 'level' ] ) { return 1 ; } if ( $ a [ 'level' ] < $ b [ 'level' ] ) { return - 1 ; } if ( $ a [ 'cDisplayOrder' ] > $ b [ 'cDisplayOrder' ] ) { return 1 ; } if ( $ a [ 'cDisplayOrder' ] < $ b [ 'cDisplayOrder' ] ) { return - 1 ; } if (... | Sort a list of pages so that the order is correct for the duplication . |
10,158 | public function queueForDeletion ( ) { $ pages = [ ] ; $ includeThisPage = true ; if ( $ this -> getCollectionPath ( ) == Config :: get ( 'concrete.paths.trash' ) ) { $ includeThisPage = false ; } $ pages = $ this -> populateRecursivePages ( $ pages , [ 'cID' => $ this -> getCollectionID ( ) ] , $ this -> getCollection... | Add this page and its subpages to the Delete Page queue . |
10,159 | public function addAdditionalPagePath ( $ cPath , $ commit = true ) { $ em = \ ORM :: entityManager ( ) ; $ path = new \ Concrete \ Core \ Entity \ Page \ PagePath ( ) ; $ path -> setPagePath ( '/' . trim ( $ cPath , '/' ) ) ; $ path -> setPageObject ( $ this ) ; $ em -> persist ( $ path ) ; if ( $ commit ) { $ em -> f... | Add a non - canonical page path to the current page . |
10,160 | public function setCanonicalPagePath ( $ cPath , $ isAutoGenerated = false ) { $ em = \ ORM :: entityManager ( ) ; $ path = $ this -> getCollectionPathObject ( ) ; if ( is_object ( $ path ) ) { $ path -> setPagePath ( $ cPath ) ; } else { $ path = new \ Concrete \ Core \ Entity \ Page \ PagePath ( ) ; $ path -> setPage... | Set the canonical page path for a page . |
10,161 | public function getAdditionalPagePaths ( ) { $ em = \ ORM :: entityManager ( ) ; return $ em -> getRepository ( '\Concrete\Core\Entity\Page\PagePath' ) -> findBy ( [ 'cID' => $ this -> getCollectionID ( ) , 'ppIsCanonical' => false , ] ) ; } | Get all the non - canonical page paths of this page . |
10,162 | public function isBlockAliasedFromMasterCollection ( $ b ) { if ( ! $ b -> isAlias ( ) ) { return false ; } if ( is_null ( $ this -> blocksAliasedFromMasterCollection ) ) { $ db = Database :: connection ( ) ; $ q = 'SELECT cvb.bID FROM CollectionVersionBlocks AS cvb INNER JOIN CollectionVersionBlocks... | Check if a block is an alias from a page default . |
10,163 | public function getCollectionThemeObject ( ) { if ( ! isset ( $ this -> themeObject ) ) { $ app = Facade :: getFacadeApplication ( ) ; $ tmpTheme = $ app -> make ( ThemeRouteCollection :: class ) -> getThemeByRoute ( $ this -> getCollectionPath ( ) ) ; if ( isset ( $ tmpTheme [ 0 ] ) ) { switch ( $ tmpTheme [ 0 ] ) { c... | Get the collection s theme object . |
10,164 | public function getCollectionName ( ) { if ( isset ( $ this -> vObj ) ) { return isset ( $ this -> vObj -> cvName ) ? $ this -> vObj -> cvName : null ; } return isset ( $ this -> cvName ) ? $ this -> cvName : null ; } | Get the page name . |
10,165 | public static function getCollectionParentIDFromChildID ( $ cID ) { $ db = Database :: connection ( ) ; $ q = 'select cParentID from Pages where cID = ?' ; $ cParentID = $ db -> fetchColumn ( $ q , [ $ cID ] ) ; return $ cParentID ; } | Get the parent cID of a page given its cID . |
10,166 | public function setTheme ( $ pl ) { $ db = Database :: connection ( ) ; $ db -> executeQuery ( 'update CollectionVersions set pThemeID = ? where cID = ? and cvID = ?' , [ $ pl -> getThemeID ( ) , $ this -> cID , $ this -> vObj -> getVersionID ( ) ] ) ; $ this -> themeObject = $ pl ; } | Set the theme of this page . |
10,167 | public function setPageType ( \ Concrete \ Core \ Page \ Type \ Type $ type = null ) { $ ptID = 0 ; if ( is_object ( $ type ) ) { $ ptID = $ type -> getPageTypeID ( ) ; } $ db = Database :: connection ( ) ; $ db -> executeQuery ( 'update Pages set ptID = ? where cID = ?' , [ $ ptID , $ this -> cID ] ) ; $ this -> ptID ... | Set the theme for a page using the page object . |
10,168 | public function getMasterCollectionID ( ) { $ pt = PageType :: getByID ( $ this -> getPageTypeID ( ) ) ; if ( ! is_object ( $ pt ) ) { return 0 ; } $ template = PageTemplate :: getByID ( $ this -> getPageTemplateID ( ) ) ; if ( ! is_object ( $ template ) ) { return 0 ; } $ c = $ pt -> getPageTypePageTemplateDefaultPage... | Get the master page of this page given its page template and page type . |
10,169 | public function getFirstChild ( $ sortColumn = 'cDisplayOrder asc' ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ now = $ app -> make ( 'date' ) -> getOverridableNow ( ) ; $ cID = $ db -> fetchColumn ( <<<EOTselect Pages.cIDfrom Pages inner jo... | Get the first child of the current page or null if there is no child . |
10,170 | public function getCollectionChildrenArray ( $ oneLevelOnly = 0 ) { $ this -> childrenCIDArray = [ ] ; $ this -> _getNumChildren ( $ this -> cID , $ oneLevelOnly ) ; return $ this -> childrenCIDArray ; } | Get the list of child page IDs sorted by their display order . |
10,171 | public function getCollectionChildren ( ) { $ children = [ ] ; $ db = Database :: connection ( ) ; $ q = 'select cID from Pages where cParentID = ? and cIsTemplate = 0 order by cDisplayOrder asc' ; $ r = $ db -> executeQuery ( $ q , [ $ this -> getCollectionID ( ) ] ) ; if ( $ r ) { while ( $ row = $ r -> fetchRow ( ) ... | Get the immediate children of the this page . |
10,172 | public function getPageRelations ( ) { $ em = \ Database :: connection ( ) -> getEntityManager ( ) ; $ r = $ em -> getRepository ( 'Concrete\Core\Entity\Page\Relation\SiblingRelation' ) ; $ relation = $ r -> findOneBy ( [ 'cID' => $ this -> getCollectionID ( ) ] ) ; $ relations = array ( ) ; if ( is_object ( $ relation... | Get the relations of this page . |
10,173 | public function duplicateAll ( $ nc = null , $ preserveUserID = false , Site $ site = null ) { $ nc2 = $ this -> duplicate ( $ nc , $ preserveUserID , $ site ) ; self :: _duplicateAll ( $ this , $ nc2 , $ preserveUserID , $ site ) ; return $ nc2 ; } | Duplicate this page and all its child pages and return the new Page created . |
10,174 | protected function _duplicateAll ( $ cParent , $ cNewParent , $ preserveUserID = false , Site $ site = null ) { $ db = Database :: connection ( ) ; $ cID = $ cParent -> getCollectionID ( ) ; $ q = 'select cID, ptHandle from Pages p left join PageTypes pt on p.ptID = pt.ptID where cParentID = ? order by cDisplayOrder as... | Duplicate all the child pages of a specific page which has already have been duplicated . |
10,175 | public function duplicate ( $ nc = null , $ preserveUserID = false , TreeInterface $ site = null ) { $ app = Application :: getFacadeApplication ( ) ; $ cloner = $ app -> make ( Cloner :: class ) ; $ clonerOptions = $ app -> build ( ClonerOptions :: class ) -> setKeepOriginalAuthor ( $ preserveUserID ) ; return $ clone... | Duplicate this page and return the new Page created . |
10,176 | public function moveToTrash ( ) { $ pe = new Event ( $ this ) ; Events :: dispatch ( 'on_page_move_to_trash' , $ pe ) ; $ trash = self :: getByPath ( Config :: get ( 'concrete.paths.trash' ) ) ; $ app = Facade :: getFacadeApplication ( ) ; $ logger = $ app -> make ( 'log/factory' ) -> createLogger ( Channels :: CHANNEL... | Move this page and all its child pages to the trash . |
10,177 | public static function getHomePageID ( $ page = null ) { if ( $ page ) { if ( ! $ page instanceof self ) { $ page = self :: getByID ( $ page ) ; } if ( $ page instanceof Page ) { $ siteTree = $ page -> getSiteTreeObject ( ) ; if ( $ siteTree !== null ) { return $ siteTree -> getSiteHomePageID ( ) ; } } } $ locale = App... | Get the ID of the home page . |
10,178 | public function getAutoGeneratedPagePathObject ( ) { $ path = new PagePath ( ) ; $ path -> setPagePathIsAutoGenerated ( true ) ; $ path -> setPagePath ( $ this -> computeCanonicalPagePath ( ) ) ; return $ path ; } | Get a new PagePath object with the computed canonical page path . |
10,179 | public function getNextSubPageDisplayOrder ( ) { $ db = Database :: connection ( ) ; $ max = $ db -> fetchColumn ( 'select max(cDisplayOrder) from Pages where cParentID = ?' , [ $ this -> getCollectionID ( ) ] ) ; return is_numeric ( $ max ) ? ( $ max + 1 ) : 0 ; } | Get the next available display order of child pages . |
10,180 | public function rescanCollectionPath ( ) { $ newPath = $ this -> generatePagePath ( ) ; $ pathObject = $ this -> getCollectionPathObject ( ) ; $ ppIsAutoGenerated = true ; if ( is_object ( $ pathObject ) && ! $ pathObject -> isPagePathAutoGenerated ( ) ) { $ ppIsAutoGenerated = false ; } $ this -> setCanonicalPagePath ... | Recalculate the canonical page path for the current page and its sub - pages based on its current version URL slug etc . |
10,181 | protected function computeCanonicalPagePath ( ) { $ parent = self :: getByID ( $ this -> cParentID ) ; $ parentPath = $ parent -> getCollectionPathObject ( ) ; $ path = '' ; if ( $ parentPath instanceof PagePath ) { $ path = $ parentPath -> getPagePath ( ) ; } $ path .= '/' ; $ cID = ( $ this -> getCollectionPointerOri... | Get the canonical path string of this page . This happens before any uniqueness checks get run . |
10,182 | public function movePageDisplayOrderToBottom ( ) { $ db = Database :: connection ( ) ; $ mx = $ db -> fetchAssoc ( 'select max(cDisplayOrder) as m from Pages where cParentID = ?' , [ $ this -> getCollectionParentID ( ) ] ) ; $ max = $ mx ? $ mx [ 'm' ] : 0 ; ++ $ max ; $ this -> updateDisplayOrder ( $ max ) ; } | Make this page the first child of its parent . |
10,183 | public function movePageDisplayOrderToSibling ( Page $ c , $ position = 'before' ) { $ myCID = $ this -> getCollectionPointerOriginalID ( ) ? : $ this -> getCollectionID ( ) ; $ relatedCID = $ c -> getCollectionPointerOriginalID ( ) ? : $ c -> getCollectionID ( ) ; $ pageIDs = [ ] ; $ db = Database :: connection ( ) ; ... | Move this page before of after another page . |
10,184 | public function rescanSystemPageStatus ( ) { $ systemPage = false ; $ db = Database :: connection ( ) ; $ cID = $ this -> getCollectionID ( ) ; if ( ! $ this -> isHomePage ( ) ) { if ( $ this -> getSiteTreeID ( ) == 0 ) { $ systemPage = true ; } else { $ cID = ( $ this -> getCollectionPointerOriginalID ( ) > 0 ) ? $ th... | Recalculate the is a system page state . Looks at the current page . If the site tree ID is 0 sets system page to true . If the site tree is not user looks at where the page falls in the hierarchy . If it s inside a page at the top level that has 0 as its parent then it is considered a system page . |
10,185 | public function isInTrash ( ) { return $ this -> getCollectionPath ( ) != Config :: get ( 'concrete.paths.trash' ) && strpos ( $ this -> getCollectionPath ( ) , Config :: get ( 'concrete.paths.trash' ) ) === 0 ; } | Is this page in the trash? |
10,186 | public function moveToRoot ( ) { $ db = Database :: connection ( ) ; $ db -> executeQuery ( 'update Pages set cParentID = 0 where cID = ?' , [ $ this -> getCollectionID ( ) ] ) ; $ this -> cParentID = 0 ; $ this -> rescanSystemPageStatus ( ) ; } | Make this page child of nothing thus moving it to the root level . |
10,187 | public function setPageToDraft ( ) { $ db = Database :: connection ( ) ; $ db -> executeQuery ( 'update Pages set cIsDraft = 1 where cID = ?' , [ $ this -> getCollectionID ( ) ] ) ; $ this -> cIsDraft = true ; } | Mark this page as non draft . |
10,188 | protected function _associateMasterCollectionAttributes ( $ newCID , $ masterCID ) { $ mc = self :: getByID ( $ masterCID , 'ACTIVE' ) ; $ nc = self :: getByID ( $ newCID , 'RECENT' ) ; $ attributes = CollectionKey :: getAttributeValues ( $ mc ) ; foreach ( $ attributes as $ attribute ) { $ value = $ attribute -> getVa... | Duplicate the master collection attributes to a newly created page . |
10,189 | public static function addHomePage ( TreeInterface $ siteTree = null ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ cParentID = 0 ; $ uID = HOME_UID ; $ data = [ 'name' => HOME_NAME , 'uID' => $ uID , ] ; $ cobj = parent :: createCollection ( $ data ) ; $ cID = $ ... | Add the home page to the system . Typically used only by the installation program . |
10,190 | protected function acquireAreaStylesFromDefaults ( \ Concrete \ Core \ Entity \ Page \ Template $ template ) { $ pt = $ this -> getPageTypeObject ( ) ; if ( is_object ( $ pt ) ) { $ mc = $ pt -> getPageTypePageTemplateDefaultPageObject ( $ template ) ; $ db = Database :: connection ( ) ; $ db -> delete ( 'CollectionVer... | Copy the area styles from a page template . |
10,191 | public function setPageDraftTargetParentPageID ( $ cParentID ) { if ( $ cParentID != $ this -> getPageDraftTargetParentPageID ( ) ) { Section :: unregisterPage ( $ this ) ; } $ db = Database :: connection ( ) ; $ cParentID = intval ( $ cParentID ) ; $ db -> executeQuery ( 'update Pages set cDraftTargetParentPageID = ? ... | Set the ID of the draft parent page ID . |
10,192 | protected function getSiteNameForLocale ( $ locale ) { static $ names = array ( ) ; if ( ! isset ( $ names [ $ locale ] ) ) { $ prevLocale = \ Localization :: activeLocale ( ) ; if ( $ prevLocale !== $ locale ) { \ Localization :: changeLocale ( $ locale ) ; } $ names [ $ locale ] = tc ( 'SiteName' , $ this -> app -> m... | Get the localized site name . |
10,193 | public function getSiteNameForPage ( \ Concrete \ Core \ Page \ Page $ page ) { static $ multilingual ; static $ defaultLocale ; if ( ! isset ( $ multilingual ) ) { $ multilingual = $ this -> app -> make ( 'multilingual/detector' ) -> isEnabled ( ) ; } if ( $ multilingual ) { if ( ! isset ( $ defaultLocale ) ) { $ defa... | Get the site name localized for a specific page . |
10,194 | public function shortenURL ( $ strURL ) { $ file = Loader :: helper ( 'file' ) ; $ url = $ file -> getContents ( "http://tinyurl.com/api-create.php?url=" . $ strURL ) ; return $ url ; } | Shortens a given url with the tiny url api . |
10,195 | public function create ( ) { $ type = NodeType :: getByHandle ( 'file' ) ; if ( ! is_object ( $ type ) ) { NodeType :: add ( 'file' ) ; } $ type = NodeType :: getByHandle ( 'file_folder' ) ; if ( ! is_object ( $ type ) ) { NodeType :: add ( 'file_folder' ) ; } $ type = NodeType :: getByHandle ( 'search_preset' ) ; if (... | Creates everything necessary to store files in folders . |
10,196 | public function csv_export ( ) { $ search = $ this -> app -> make ( 'Concrete\Controller\Search\Users' ) ; $ result = $ search -> getCurrentSearchObject ( ) ; $ headers = [ 'Content-Type' => 'text/csv' , 'Content-Disposition' => 'attachment; filename=concrete5_users.csv' , ] ; $ app = $ this -> app ; $ config = $ this ... | Export Users using the current search filters into a CSV . |
10,197 | public function process ( $ dataRowsToSkip = 0 , $ maxDataRows = null , $ collectData = false ) { $ result = $ this -> app -> make ( ImportResult :: class ) ; if ( $ this -> processHeader ( $ result ) ) { if ( $ this -> dryRun !== false ) { $ this -> entityManager -> getConnection ( ) -> beginTransaction ( ) ; } try { ... | Process the CSV data . |
10,198 | protected function processHeader ( ImportResult $ importResult ) { $ result = false ; $ this -> csvSchema = null ; $ csvSchema = null ; $ this -> reader -> each ( function ( $ headerCells , $ rowIndex ) use ( & $ csvSchema ) { $ csvSchema = new CsvSchema ( $ rowIndex , $ headerCells , $ this -> getStaticHeaders ( ) , $... | Read the header row and initialize the CSV schema . |
10,199 | protected function processData ( ImportResult $ importResult , $ dataRowsToSkip , $ maxDataRows , $ collectData = false ) { if ( $ collectData !== false ) { $ dataCollected = [ 'attributeKeys' => [ ] , 'attributeControllers' => [ ] , 'data' => [ ] , ] ; } else { $ dataCollected = null ; } if ( $ this -> csvSchema === n... | Read the data rows and process them . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.