idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
10,300
public function trackAttempt ( $ username , $ password ) { if ( ! $ this -> config -> get ( 'concrete.user.deactivation.authentication_failure.enabled' , false ) ) { return $ this ; } $ user = $ this -> resolveUser ( $ username ) ; if ( ! $ user ) { return ; } $ attempt = new LoginAttempt ( ) ; $ attempt -> setUtcDate ...
Track a login attempt for a user
10,301
public function remainingAttempts ( $ username ) { $ config = $ this -> config -> get ( 'concrete.user.deactivation.authentication_failure' ) ; $ allowed = ( int ) array_get ( $ config , 'amount' , 0 ) ; $ duration = ( int ) array_get ( $ config , 'duration' , 0 ) ; $ after = Carbon :: now ( 'UTC' ) -> subSeconds ( $ d...
Determine the amount of attempts remaining for a username
10,302
public function deactivate ( $ username ) { if ( ! $ this -> config -> get ( 'concrete.user.deactivation.authentication_failure.enabled' , false ) ) { return ; } $ user = $ this -> resolveUser ( $ username ) ; if ( ! $ user ) { throw new InvalidArgumentException ( t ( 'Unable to find and deactivate given user' ) ) ; } ...
Deactivate a given username
10,303
public function pruneAttempts ( DateTime $ before = null ) { if ( ! $ before ) { $ duration = ( int ) $ this -> config -> get ( 'concrete.user.deactivation.authentication_failure.duration' ) ; $ before = Carbon :: now ( 'UTC' ) -> subSeconds ( $ duration ) ; } $ repository = $ this -> entityManager -> getRepository ( L...
Prune old login attempts
10,304
private function manageBatch ( array $ batch , $ max = 0 ) { if ( count ( $ batch ) >= $ max ) { $ this -> entityManager -> flush ( ) ; $ batch = [ ] ; } return $ batch ; }
Manage a batched ORM operation
10,305
public function storeData ( $ key , $ data , $ expiration ) { $ path = $ this -> makePath ( $ key ) ; if ( strlen ( $ path ) > 259 && stripos ( PHP_OS , 'WIN' ) === 0 ) { throw new WindowsPathMaxLengthException ( ) ; } if ( ! file_exists ( $ path ) ) { $ dirname = dirname ( $ path ) ; if ( ! is_dir ( $ dirname ) ) { if...
This function takes the data and stores it to the path specified . If the directory leading up to the path does not exist it creates it .
10,306
public static function getApplicationUpdateInformation ( ) { $ app = Application :: getFacadeApplication ( ) ; $ cache = $ app -> make ( 'cache' ) ; $ r = $ cache -> getItem ( 'APP_UPDATE_INFO' ) ; if ( $ r -> isMiss ( ) ) { $ r -> lock ( ) ; $ result = static :: getLatestAvailableUpdate ( ) ; $ r -> set ( $ result ) -...
Retrieves the info about the latest available information . The effective request to the remote server is done just once per request .
10,307
public function getLocalAvailableUpdates ( ) { $ app = Application :: getFacadeApplication ( ) ; $ fh = $ app -> make ( 'helper/file' ) ; $ updates = [ ] ; $ contents = @ $ fh -> getDirectoryContents ( DIR_CORE_UPDATES ) ; foreach ( $ contents as $ con ) { if ( is_dir ( DIR_CORE_UPDATES . '/' . $ con ) ) { $ obj = Appl...
Looks in the designated updates location for all directories ascertains what version they represent and finds all versions greater than the currently installed version of concrete5 .
10,308
public static function isCurrentVersionNewerThanDatabaseVersion ( ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ config = $ app -> make ( 'config' ) ; $ database = $ db -> fetchColumn ( 'select max(version) from SystemDatabaseMigrations' ) ; $ code = $ config -> g...
Checks migrations to see if the current code DB version is greater than that registered in the database .
10,309
protected function getAnnotationReader ( ) { if ( $ this -> packageSupportsLegacyCore ( ) ) { $ reader = $ this -> getLegacyAnnotationReader ( ) ; } else { $ reader = $ this -> getStandardAnnotationReader ( ) ; } return $ reader ; }
Get the correct AnnotationReader based on the packages support for LegacyCore
10,310
public function recordLogin ( ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app [ 'database' ] -> connection ( ) ; $ uLastLogin = $ db -> getOne ( "select uLastLogin from Users where uID = ?" , array ( $ this -> uID ) ) ; $ iph = $ app -> make ( 'helper/validation/ip' ) ; $ ip = $ iph -> getRequestIP (...
Increment number of logins and update login timestamps .
10,311
public function setUserDefaultLanguage ( $ lang ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app [ 'database' ] -> connection ( ) ; $ session = $ app [ 'session' ] ; $ this -> uDefaultLanguage = $ lang ; $ session -> set ( 'uDefaultLanguage' , $ lang ) ; $ db -> Execute ( 'update Users set uDefaultLan...
Sets a default language for a user record .
10,312
public function getUserLanguageToDisplay ( ) { if ( $ this -> getUserDefaultLanguage ( ) != '' ) { return $ this -> getUserDefaultLanguage ( ) ; } else { $ app = Application :: getFacadeApplication ( ) ; $ config = $ app [ 'config' ] ; return $ config -> get ( 'concrete.locale' ) ; } }
Checks to see if the current user object is registered . If so it queries that records default language . Otherwise it falls back to sitewide settings .
10,313
public function inGroup ( $ g ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app [ 'database' ] -> connection ( ) ; $ v = array ( $ this -> uID ) ; $ cnt = $ db -> GetOne ( "select Groups.gID from UserGroups inner join " . $ db -> getDatabasePlatform ( ) -> quoteSingleIdentifier ( 'Groups' ) . " on User...
Return true if user is in Group .
10,314
public function loadCollectionEdit ( & $ c ) { $ c -> refreshCache ( ) ; if ( $ c -> isCheckedOut ( ) ) { return false ; } $ app = Application :: getFacadeApplication ( ) ; $ db = $ app [ 'database' ] -> connection ( ) ; $ cID = $ c -> getCollectionID ( ) ; $ this -> unloadCollectionEdit ( false ) ; $ q = 'select cIsCh...
Loads a page in edit mode .
10,315
public function persist ( $ cache_interface = true ) { $ this -> refreshUserGroups ( ) ; $ app = Application :: getFacadeApplication ( ) ; $ session = $ app [ 'session' ] ; $ session -> set ( 'uID' , $ this -> getUserID ( ) ) ; $ session -> set ( 'uName' , $ this -> getUserName ( ) ) ; $ session -> set ( 'uBlockTypesSe...
Manage user session writing .
10,316
public static function getList ( ) { $ db = Database :: connection ( ) ; $ handles = $ db -> GetCol ( 'select cnvRatingTypeHandle from ConversationRatingTypes order by cnvRatingTypeHandle asc' ) ; $ types = array ( ) ; foreach ( $ handles as $ handle ) { $ ratingType = static :: getByHandle ( $ handle ) ; if ( is_objec...
Returns the list of all conversation rating types
10,317
public function getEditionByID ( $ cID ) { if ( ! $ this -> hasConnectionError ( ) ) { $ fileService = new File ( ) ; $ appVersion = Config :: get ( 'concrete.version' ) ; $ cfToken = Marketplace :: getSiteToken ( ) ; $ path = Config :: get ( 'concrete.urls.newsflow' ) . '/' . DISPATCHER_FILENAME . '/?_ccm_view_externa...
Retrieves a NewsflowItem object for a given collection ID .
10,318
public function getSlotContents ( ) { if ( $ this -> slots === null ) { $ fileService = new File ( ) ; $ appVersion = Config :: get ( 'concrete.version' ) ; $ cfToken = Marketplace :: getSiteToken ( ) ; $ url = Config :: get ( 'concrete.urls.newsflow' ) . Config :: get ( 'concrete.urls.paths.newsflow_slot_content' ) ; ...
Retrieves an array of NewsflowSlotItems .
10,319
protected static function getAssetContentsByRoute ( $ route ) { $ result = null ; try { $ app = Application :: getFacadeApplication ( ) ; $ router = $ app -> make ( RouterInterface :: class ) ; $ context = new RequestContext ( ) ; $ context -> fromRequest ( $ app -> make ( Request :: class ) ) ; $ context -> setMethod ...
Get the contents of an asset given its route .
10,320
public function addMiddleware ( MiddlewareInterface $ middleware , $ priority = 10 ) { $ this -> stack = $ this -> stack -> withMiddleware ( $ middleware , $ priority ) ; return $ this ; }
Add a middleware to the stack
10,321
public function removeMiddleware ( MiddlewareInterface $ middleware ) { $ this -> stack = $ this -> stack -> withoutMiddleware ( $ middleware ) ; return $ this ; }
Remove a middleware from the stack
10,322
public function handleRequest ( SymfonyRequest $ request ) { $ stack = $ this -> stack ; if ( $ stack instanceof MiddlewareStack ) { $ stack = $ stack -> withDispatcher ( $ this -> app -> make ( DispatcherDelegate :: class , [ $ this -> dispatcher ] ) ) ; } return $ stack -> process ( $ request ) ; }
Take a request and pass it through middleware then return the response
10,323
private function forgetCollection ( Collection $ collection ) { $ query_builder = $ this -> manager -> createQueryBuilder ( ) ; $ query_builder -> delete ( StackUsageRecord :: class , 'r' ) -> where ( 'r.collection_id = :collection_id' ) -> setParameter ( 'collection_id' , $ collection -> getCollectionID ( ) ) -> getQu...
Forget about a collection object
10,324
public function validateAuthorization ( ServerRequestInterface $ request ) { $ user = $ this -> app -> make ( User :: class ) ; return $ this -> validator -> validateAuthorization ( $ request ) ; }
Determine the access token in the authorization header and append OAUth properties to the request as attributes .
10,325
public function getWorkflowObject ( ) { if ( $ this -> wfID > 0 ) { $ wf = Workflow :: getByID ( $ this -> wfID ) ; } else { $ wf = new EmptyWorkflow ( ) ; } return $ wf ; }
Gets the Workflow object attached to this WorkflowProgress object .
10,326
public function getWorkflowRequestObject ( ) { if ( $ this -> wrID > 0 ) { $ cat = WorkflowProgressCategory :: getByID ( $ this -> wpCategoryID ) ; $ handle = $ cat -> getWorkflowProgressCategoryHandle ( ) ; $ class = '\\Core\\Workflow\\Request\\' . Core :: make ( 'helper/text' ) -> camelcase ( $ handle ) . 'Request' ;...
Get the WorkflowRequest object for the current WorkflowProgress object .
10,327
public static function create ( $ wpCategoryHandle , Workflow $ wf , WorkflowRequest $ wr ) { $ db = Database :: connection ( ) ; $ wpDateAdded = Core :: make ( 'helper/date' ) -> getOverridableNow ( ) ; $ wpCategoryID = $ db -> fetchColumn ( 'select wpCategoryID from WorkflowProgressCategories where wpCategoryHandle =...
Creates a WorkflowProgress object ( which will be assigned to a Page File etc ... in our system .
10,328
public function start ( ) { $ wf = $ this -> getWorkflowObject ( ) ; if ( is_object ( $ wf ) ) { $ r = $ wf -> start ( $ this ) ; $ this -> updateOnAction ( $ wf ) ; } return $ r ; }
The function that is automatically run when a workflowprogress object is started .
10,329
public function runTask ( $ task , $ args = array ( ) ) { $ wf = $ this -> getWorkflowObject ( ) ; if ( in_array ( $ task , $ wf -> getAllowedTasks ( ) ) ) { $ wpr = call_user_func_array ( array ( $ wf , $ task ) , array ( $ this , $ args ) ) ; $ this -> updateOnAction ( $ wf ) ; } if ( ! ( $ wpr instanceof Response ) ...
Attempts to run a workflow task on the bound WorkflowRequest object first then if that doesn t exist attempts to run it on the current WorkflowProgress object .
10,330
public function action ( $ action , $ task = null ) { return $ this -> app -> make ( ResolverManagerInterface :: class ) -> resolve ( func_get_args ( ) ) ; }
Returns an action suitable for including in a form action property .
10,331
public function hidden ( $ key , $ value = null , $ miscFields = [ ] ) { $ requestValue = $ this -> getRequestValue ( $ key ) ; if ( $ requestValue !== false && ( ! is_array ( $ requestValue ) ) ) { $ value = $ requestValue ; } return '<input type="hidden" id="' . $ key . '" name="' . $ key . '"' . $ this -> parseMiscF...
Creates a hidden form field .
10,332
public function checkbox ( $ key , $ value , $ isChecked = false , $ miscFields = [ ] ) { if ( substr ( $ key , - 2 ) == '[]' ) { $ _field = substr ( $ key , 0 , - 2 ) ; $ id = $ _field . '_' . $ value ; } else { $ _field = $ key ; $ id = $ key ; } $ checked = false ; if ( $ isChecked && $ this -> getRequest ( ) -> get...
Generates a checkbox .
10,333
public function textarea ( $ key , $ valueOrMiscFields = '' , $ miscFields = [ ] ) { if ( is_array ( $ valueOrMiscFields ) ) { $ value = '' ; $ miscFields = $ valueOrMiscFields ; } else { $ value = $ valueOrMiscFields ; } $ requestValue = $ this -> getRequestValue ( $ key ) ; if ( is_string ( $ requestValue ) ) { $ val...
Creates a textarea field .
10,334
public function radio ( $ key , $ value , $ checkedValueOrMiscFields = '' , $ miscFields = [ ] ) { if ( is_array ( $ checkedValueOrMiscFields ) ) { $ checkedValue = '' ; $ miscFields = $ checkedValueOrMiscFields ; } else { $ checkedValue = $ checkedValueOrMiscFields ; } $ checked = false ; $ requestValue = $ this -> ge...
Generates a radio button .
10,335
public function select ( $ key , $ optionValues , $ valueOrMiscFields = '' , $ miscFields = [ ] ) { if ( ! is_array ( $ optionValues ) ) { $ optionValues = [ ] ; } if ( is_array ( $ valueOrMiscFields ) ) { $ selectedValue = '' ; $ miscFields = $ valueOrMiscFields ; } else { $ selectedValue = ( string ) $ valueOrMiscFie...
Renders a select field .
10,336
public function selectMultiple ( $ key , $ optionValues , $ defaultValues = false , $ miscFields = [ ] ) { $ requestValue = $ this -> getRequestValue ( $ key . '[]' ) ; if ( $ requestValue !== false ) { $ selectedValues = $ requestValue ; } else { $ selectedValues = $ defaultValues ; } if ( ! is_array ( $ selectedValue...
Renders a multiple select box .
10,337
protected function parseMiscFields ( $ defaultClass , $ attributes ) { $ attributes = ( array ) $ attributes ; if ( $ defaultClass ) { $ attributes [ 'class' ] = trim ( ( isset ( $ attributes [ 'class' ] ) ? $ attributes [ 'class' ] : '' ) . ' ' . $ defaultClass ) ; } $ attr = '' ; foreach ( $ attributes as $ k => $ v ...
Create an HTML fragment of attribute values merging any CSS class names as necessary .
10,338
public static function getByVersionNumber ( $ version ) { $ updates = id ( new Update ( ) ) -> getLocalAvailableUpdates ( ) ; foreach ( $ updates as $ up ) { if ( $ up -> getUpdateVersion ( ) == $ version ) { return $ up ; } } }
Returns an ApplicationUpdate instance given its version string .
10,339
public static function get ( $ dir ) { $ version_file = DIR_CORE_UPDATES . "/{$dir}/" . DIRNAME_CORE . '/config/concrete.php' ; $ concrete = @ include $ version_file ; if ( $ concrete [ 'version' ] != false ) { $ obj = new self ( ) ; $ obj -> version = $ concrete [ 'version' ] ; $ obj -> identifier = $ dir ; return $ o...
Parse an update dir and returns an ApplicationUpdate instance .
10,340
public function getDiagnosticObject ( ) { $ app = Application :: getFacadeApplication ( ) ; $ client = $ app -> make ( 'http/client' ) ; $ request = $ client -> getRequest ( ) ; $ request -> setUri ( Config :: get ( 'concrete.updates.services.inspect_update' ) ) ; $ request -> setMethod ( 'POST' ) ; $ request -> getPos...
Given the current update object sends information to concrete5 . org to determine updatability .
10,341
public function addGroup ( $ name , $ fields = [ ] ) { $ group = new Group ( ) ; $ group -> setName ( $ name ) ; $ group -> setFields ( $ fields ) ; $ this -> addGroupObject ( $ group ) ; }
Add a group of fields .
10,342
public function saveAuthenticationType ( $ args ) { $ passedUrl = trim ( $ args [ 'url' ] ) ; if ( $ passedUrl ) { try { $ url = Url :: createFromUrl ( $ passedUrl ) ; if ( ! ( string ) $ url -> getScheme ( ) || ! ( string ) $ url -> getHost ( ) ) { throw new InvalidArgumentException ( 'No scheme or host provided.' ) ;...
Save data for this authentication type This method is called when the type_form . php submits . It stores client details and configuration for connecting
10,343
public function edit ( ) { $ config = $ this -> app -> make ( Repository :: class ) ; $ this -> set ( 'form' , $ this -> app -> make ( 'helper/form' ) ) ; $ this -> set ( 'data' , $ config -> get ( 'auth.external_concrete5' , [ ] ) ) ; $ this -> set ( 'redirectUri' , $ this -> urlResolver -> resolve ( [ '/ccm/system/au...
Controller method for type_form This method is called just before rendering type_form . php use it to set data for that template
10,344
private function setData ( ) { $ data = $ this -> config -> get ( 'auth.external_concrete5' , '' ) ; $ authUrl = $ this -> urlResolver -> resolve ( [ '/ccm/system/authentication/oauth2/external_concrete5/attempt_auth' ] ) ; $ attachUrl = $ this -> urlResolver -> resolve ( [ '/ccm/system/authentication/oauth2/external_c...
Method for setting general data for all views
10,345
public function handleEvent ( Event $ event ) { if ( ! $ event instanceof UserInfoWithPassword ) { throw new InvalidArgumentException ( t ( 'Invalid event type provided. Event type must be "UserInfoWithPassword".' ) ) ; } $ this -> tracker -> trackUse ( $ event -> getUserPassword ( ) , $ event -> getUserInfoObject ( ) ...
Event handler for on_user_change_password events
10,346
private function detectFromPHPInfo ( $ value ) { $ result = null ; if ( is_string ( $ value ) && preg_match ( '/\bApache\/(\d+(\.\d+)+)/i' , $ value , $ m ) ) { $ result = $ m [ 1 ] ; } return $ result ; }
Detect using PHPInfo .
10,347
public function route ( $ data ) { if ( is_array ( $ data ) ) { $ path = $ data [ 0 ] ; $ pkg = $ data [ 1 ] ; } else { $ path = $ data ; } $ path = trim ( $ path , '/' ) ; $ pkgHandle = null ; if ( $ pkg ) { if ( is_object ( $ pkg ) ) { $ pkgHandle = $ pkg -> getPackageHandle ( ) ; } else { $ pkgHandle = $ pkg ; } } $...
Returns a route string based on data . DO NOT USE THIS .
10,348
public function deliver ( PageCacheRecord $ record ) { $ response = new Response ( ) ; $ headers = [ ] ; if ( defined ( 'APP_CHARSET' ) ) { $ headers [ 'Content-Type' ] = 'text/html; charset=' . APP_CHARSET ; } $ headers = array_merge ( $ headers , $ record -> getCacheRecordHeaders ( ) ) ; $ response -> headers -> add ...
Build a Response object starting from a cached page .
10,349
public static function getLibrary ( ) { if ( ! self :: $ library ) { $ app = Application :: getFacadeApplication ( ) ; $ config = $ app -> make ( 'config' ) ; $ adapter = $ config -> get ( 'concrete.cache.page.adapter' ) ; $ class = overrideable_core_class ( 'Core\\Cache\\Page\\' . camelcase ( $ adapter ) . 'PageCache'...
Get the page cache library .
10,350
public function shouldCheckCache ( Request $ req ) { if ( $ req -> getMethod ( ) === $ req :: METHOD_POST ) { return false ; } $ app = Application :: getFacadeApplication ( ) ; $ config = $ app -> make ( 'config' ) ; $ cookie = $ app -> make ( 'cookie' ) ; $ loginCookie = sprintf ( '%s_LOGIN' , $ config -> get ( 'concr...
Determine if we should check if a page is in the cache .
10,351
public function outputCacheHeaders ( ConcretePage $ c ) { foreach ( $ this -> getCacheHeaders ( $ c ) as $ header ) { header ( $ header ) ; } }
Send the cache - related HTTP headers for a page to the current response .
10,352
public function getCacheHeaders ( ConcretePage $ c ) { $ lifetime = $ c -> getCollectionFullPageCachingLifetimeValue ( ) ; $ expires = gmdate ( 'D, d M Y H:i:s' , time ( ) + $ lifetime ) . ' GMT' ; $ headers = [ 'Pragma' => 'public' , 'Cache-Control' => 'max-age=' . $ lifetime . ',s-maxage=' . $ lifetime , 'Expires' =>...
Get the cache - related HTTP headers for a page .
10,353
public function shouldAddToCache ( PageView $ v ) { $ c = $ v -> getPageObject ( ) ; if ( ! is_object ( $ c ) ) { return false ; } $ cp = new Checker ( $ c ) ; if ( ! $ cp -> canViewPage ( ) ) { return false ; } if ( is_object ( $ v -> controller ) ) { $ allowedControllerActions = [ 'view' ] ; if ( ! in_array ( $ v -> ...
Check if a page contained in a PageView should be stored in the cache .
10,354
public function getCacheKey ( $ mixed ) { if ( $ mixed instanceof ConcretePage ) { $ collectionPath = trim ( ( string ) $ mixed -> getCollectionPath ( ) , '/' ) ; if ( $ collectionPath !== '' ) { return urlencode ( $ collectionPath ) ; } $ cID = $ mixed -> getCollectionID ( ) ; if ( $ cID && $ cID == ConcretePage :: ge...
Get the key that identifies the cache entry for a page or a request .
10,355
protected function canMoveStacks ( $ parent ) { $ page = ( $ parent instanceof \ Concrete \ Core \ Page \ Page ) ? $ parent : $ parent -> getPage ( ) ; $ cpc = new Permissions ( $ page ) ; return ( bool ) $ cpc -> canMoveOrCopyPage ( ) ; }
Check if stacks in a Page or StackFolder can be moved .
10,356
public function getContext ( ) { return [ 'username' => $ this -> username , 'requestPath' => $ this -> requestPath , 'errors' => $ this -> errors , 'groups' => $ this -> groups , 'successful' => ! $ this -> errors ] ; }
Get the added context for the log entry
10,357
public function filterByPageTemplate ( TemplateEntity $ template ) { $ this -> query -> andWhere ( 'cv.pTemplateID = :pTemplateID' ) ; $ this -> query -> setParameter ( 'pTemplateID' , $ template -> getPageTemplateID ( ) ) ; }
Filters by page template .
10,358
public function filterByNumberOfChildren ( $ number , $ comparison = '>' ) { $ number = intval ( $ number ) ; if ( $ this -> includeAliases ) { $ this -> query -> andWhere ( $ this -> query -> expr ( ) -> orX ( $ this -> query -> expr ( ) -> comparison ( 'p.cChildren' , $ comparison , ':cChildren' ) , $ this -> query -...
Filter by number of children .
10,359
public function filterByDateLastModified ( $ date , $ comparison = '=' ) { $ this -> query -> andWhere ( $ this -> query -> expr ( ) -> comparison ( 'c.cDateModified' , $ comparison , $ this -> query -> createNamedParameter ( $ date ) ) ) ; }
Filter by last modified date .
10,360
public function filterByPageTypeID ( $ ptID ) { $ db = \ Database :: get ( ) ; if ( is_array ( $ ptID ) ) { $ this -> query -> andWhere ( $ this -> query -> expr ( ) -> in ( 'pt.ptID' , array_map ( [ $ db , 'quote' ] , $ ptID ) ) ) ; } else { $ this -> query -> andWhere ( $ this -> query -> expr ( ) -> comparison ( 'pt...
Filters by page type ID .
10,361
public function filterByParentID ( $ cParentID ) { $ db = \ Database :: get ( ) ; if ( is_array ( $ cParentID ) ) { $ this -> query -> andWhere ( $ this -> query -> expr ( ) -> in ( 'p.cParentID' , array_map ( [ $ db , 'quote' ] , $ cParentID ) ) ) ; } else { $ this -> query -> andWhere ( 'p.cParentID = :cParentID' ) ;...
Filters by parent ID .
10,362
public function filterByName ( $ name , $ exact = false ) { if ( $ exact ) { $ this -> query -> andWhere ( 'cv.cvName = :cvName' ) ; $ this -> query -> setParameter ( 'cvName' , $ name ) ; } else { $ this -> query -> andWhere ( $ this -> query -> expr ( ) -> like ( 'cv.cvName' , ':cvName' ) ) ; $ this -> query -> setPa...
Filters a list by page name .
10,363
public function filterByPath ( $ path , $ includeAllChildren = true ) { if ( ! $ includeAllChildren ) { $ this -> query -> andWhere ( 'pp.cPath = :cPath' ) ; $ this -> query -> setParameter ( 'cPath' , $ path ) ; } else { $ this -> query -> andWhere ( $ this -> query -> expr ( ) -> like ( 'pp.cPath' , ':cPath' ) ) ; $ ...
Filter a list by page path .
10,364
public function filterByKeywords ( $ keywords ) { $ expressions = [ $ this -> query -> expr ( ) -> like ( 'psi.cName' , ':keywords' ) , $ this -> query -> expr ( ) -> like ( 'psi.cDescription' , ':keywords' ) , $ this -> query -> expr ( ) -> like ( 'psi.content' , ':keywords' ) , ] ; $ keys = \ CollectionAttributeKey :...
Filters keyword fields by keywords ( including name description content and attributes .
10,365
protected function getOptions ( Repository $ config ) { $ result = $ config -> get ( 'app.http_client' ) ; if ( ! is_array ( $ result ) ) { $ result = [ ] ; } $ result [ 'proxyhost' ] = $ config -> get ( 'concrete.proxy.host' ) ; $ result [ 'proxyport' ] = $ config -> get ( 'concrete.proxy.port' ) ; $ result [ 'proxyus...
Read the HTTP Client configuration .
10,366
protected function transformKey ( $ key ) { $ key = sprintf ( 'site.sites.%s.%s' , $ this -> site -> getSiteHandle ( ) , $ key ) ; return parent :: transformKey ( $ key ) ; }
Prepend the site config group and the current site handle
10,367
public function getViewportHTML ( ) { $ added_data = array ( 'handle' , 'name' , 'brand' , 'width' , 'height' , 'ratio' , 'agent' , ) ; $ datas = array ( ) ; foreach ( $ added_data as $ key ) { $ datas [ ] = sprintf ( 'data-device-%s="%s"' , $ key , h ( $ this -> { $ key } ) ) ; } return sprintf ( '<div class="ccm-devi...
Get the HTML for this device s viewport .
10,368
public function index ( $ page ) { if ( $ page = $ this -> getPage ( $ page ) ) { if ( $ page -> getVersionObject ( ) ) { return $ page -> reindex ( $ this -> search , true ) ; } } return false ; }
Add a page to the index
10,369
public function forget ( $ page ) { if ( $ page = $ this -> getPage ( $ page ) ) { $ database = $ this -> app [ 'database' ] -> connection ( ) ; $ database -> executeQuery ( 'DELETE FROM PageSearchIndex WHERE cID=?' , [ $ page -> getCollectionID ( ) ] ) ; } return false ; }
Remove a page from the index
10,370
protected function getPage ( $ page ) { if ( is_numeric ( $ page ) ) { return Page :: getByID ( $ page ) ; } if ( is_string ( $ page ) ) { return Page :: getByPath ( $ page ) ; } if ( $ page instanceof Page ) { return $ page ; } if ( $ page instanceof Collection ) { return $ this -> getPage ( $ page -> getCollectionID ...
Get a page based on criteria
10,371
public function csv_export ( $ treeNodeParentID = null ) { $ me = $ this ; $ parent = $ me -> getParentNode ( $ treeNodeParentID ) ; $ entity = $ me -> getEntity ( $ parent ) ; $ permissions = new \ Permissions ( $ entity ) ; if ( ! $ permissions -> canViewExpressEntries ( ) ) { throw new \ Exception ( t ( 'Access Deni...
Export Express entries into a CSV .
10,372
public function insertObject ( ObjectInterface $ object ) { $ this -> writer -> insertOne ( iterator_to_array ( $ this -> projectObject ( $ object ) ) ) ; return $ this ; }
Insert a row for a specific object instance .
10,373
public function insertList ( ItemList $ list ) { $ this -> writer -> insertAll ( $ this -> projectList ( $ list ) ) ; return $ this ; }
Insert one row for every object in a database list .
10,374
protected function projectHeaders ( ) { foreach ( $ this -> getStaticHeaders ( ) as $ header ) { yield $ header ; } foreach ( $ this -> getAttributeKeysAndControllers ( ) as list ( $ attributeKey , $ attributeController ) ) { $ handle = 'a:' . $ attributeKey -> getAttributeKeyHandle ( ) ; if ( $ attributeController ins...
A generator that returns all headers .
10,375
protected function projectObject ( ObjectInterface $ object ) { foreach ( $ this -> getStaticFieldValues ( $ object ) as $ value ) { yield $ value ; } foreach ( $ this -> getAttributeKeysAndControllers ( ) as list ( $ attributeKey , $ attributeController ) ) { $ value = $ object -> getAttributeValueObject ( $ attribute...
A generator that returns all fields of an object instance .
10,376
protected function projectList ( ItemList $ list ) { $ sth = $ list -> deliverQueryObject ( ) -> execute ( ) ; foreach ( $ sth as $ row ) { $ listResult = $ list -> getResult ( $ row ) ; $ object = $ this -> getObjectFromListResult ( $ list , $ listResult ) ; yield iterator_to_array ( $ this -> projectObject ( $ object...
A generator that returns all the rows for an object list .
10,377
protected function unloadDoctrineEntities ( ) { $ this -> attributeKeysAndControllers = null ; $ app = Application :: getFacadeApplication ( ) ; $ entityManager = $ app -> make ( EntityManagerInterface :: class ) ; $ entityManager -> clear ( ) ; $ category = $ this -> getCategory ( ) ; if ( $ category !== null ) { $ ca...
Unload every Doctrine entites and reset the state of this instance .
10,378
public function setSessionPostLoginUrl ( $ url ) { $ normalized = null ; if ( $ url instanceof Page ) { if ( ! $ url -> isError ( ) ) { $ cID = ( int ) $ url -> getCollectionID ( ) ; if ( $ cID > 0 ) { $ normalized = $ cID ; } } } elseif ( $ this -> valn -> integer ( $ url , 1 ) ) { $ normalized = ( int ) $ url ; } els...
Store in the session the post - login URL or page .
10,379
public function getSessionPostLoginUrl ( $ resetSessionPostLoginUrl = false ) { $ result = '' ; $ normalized = $ this -> session -> get ( static :: POSTLOGIN_SESSION_KEY ) ; if ( $ this -> valn -> integer ( $ normalized , 1 ) ) { $ page = Page :: getByID ( $ normalized ) ; if ( $ page && ! $ page -> isError ( ) ) { $ r...
Get the post - login URL as stored in the session .
10,380
public function getDefaultPostLoginUrl ( ) { $ result = '' ; $ loginRedirectMode = ( string ) $ this -> config -> get ( 'concrete.misc.login_redirect' ) ; switch ( $ loginRedirectMode ) { case 'CUSTOM' : $ loginRedirectCollectionID = $ this -> config -> get ( 'concrete.misc.login_redirect_cid' ) ; if ( $ this -> valn -...
Get the default post - login URL .
10,381
public function getPostLoginUrl ( $ resetSessionPostLoginUrl = false ) { $ result = $ this -> getSessionPostLoginUrl ( $ resetSessionPostLoginUrl ) ; if ( $ result === '' ) { $ result = $ this -> getDefaultPostLoginUrl ( ) ; if ( $ result === '' ) { $ result = $ this -> getFallbackPostLoginUrl ( ) ; } } return $ result...
Get the post - login URL .
10,382
public function getPostLoginRedirectResponse ( $ resetSessionPostLoginUrl = false ) { $ result = $ this -> responseFactory -> redirect ( $ this -> getPostLoginUrl ( $ resetSessionPostLoginUrl ) , Response :: HTTP_FOUND ) ; $ result = $ result -> setMaxAge ( 0 ) -> setSharedMaxAge ( 0 ) -> setPrivate ( ) ; $ result -> h...
Create a Response that redirects the user to the configured URL .
10,383
public function registerImporterRoutine ( RoutineInterface $ routine ) { if ( in_array ( $ routine , $ this -> routines ) ) { $ this -> routines [ array_search ( $ routine , $ this -> routines ) ] = $ routine ; } else { $ this -> routines [ ] = $ routine ; } }
Registers a core importer routine . Add - on developers should use addImporterRoutine You can use this if you want to swap out a core routine .
10,384
public function validateAttributeValue ( ) { $ at = $ this -> attributeType ; $ at -> getController ( ) -> setAttributeKey ( $ this -> attributeKey ) ; $ e = true ; if ( method_exists ( $ at -> getController ( ) , 'validateValue' ) ) { $ e = $ at -> getController ( ) -> validateValue ( ) ; } return $ e ; }
Validates the current attribute value to see if it fulfills the requirement portion of an attribute .
10,385
protected function filterSpecialCharacters ( array $ characters ) { foreach ( $ characters as $ str ) { if ( 1 != strlen ( $ str ) ) { throw new InvalidArgumentException ( sprintf ( 'The submitted string %s must be a single character' , $ str ) ) ; } } return $ characters ; }
Filter submitted special characters .
10,386
protected function escapeField ( $ cell ) { if ( ! $ this -> isStringable ( $ cell ) ) { return $ cell ; } $ str_cell = ( string ) $ cell ; if ( isset ( $ str_cell [ 0 ] , $ this -> special_chars [ $ str_cell [ 0 ] ] ) ) { return $ this -> escape . $ str_cell ; } return $ cell ; }
Escape a CSV cell .
10,387
protected function filterQueries ( $ queries ) { $ app = Application :: getFacadeApplication ( ) ; $ config = $ app -> make ( 'config' ) ; $ textIndexDrops = [ ] ; foreach ( $ config -> get ( 'database.text_indexes' ) as $ indexTable => $ indexDefinition ) { foreach ( array_keys ( $ indexDefinition ) as $ indexName ) {...
Filter out all the queries that are platform specific that Doctrine doens t give us a good way to deal with . This is mostly index lengths that are set in installation that Doctrine doesn t support .
10,388
public function trim ( $ value ) { $ result = '' ; $ value = ( string ) $ value ; if ( $ value !== '' ) { $ sign = $ value [ 0 ] ; if ( $ sign === '-' || $ sign === '+' ) { $ value = substr ( $ value , 1 ) ; } else { $ sign = '' ; } if ( $ value !== '' ) { $ value = ltrim ( $ value , '0' ) ; if ( $ value === '' || $ va...
Remove superfluous zeroes from a string containing a number .
10,389
public function getNewToken ( ClientEntityInterface $ clientEntity , array $ scopes , $ userIdentifier = null ) { $ token = new AccessToken ( ) ; $ token -> setUserIdentifier ( $ userIdentifier ) ; return $ token ; }
Create a new access token
10,390
public function persistNewAccessToken ( AccessTokenEntityInterface $ accessTokenEntity ) { $ this -> getEntityManager ( ) -> transactional ( function ( EntityManagerInterface $ em ) use ( $ accessTokenEntity ) { $ em -> persist ( $ accessTokenEntity ) ; } ) ; }
Persists a new access token to permanent storage .
10,391
public function isAccessTokenRevoked ( $ tokenId ) { $ token = $ this -> find ( $ tokenId ) ; if ( ! $ token ) { return true ; } $ now = new \ DateTime ( 'now' ) ; if ( $ token && $ token -> getExpiryDateTime ( ) < $ now ) { return true ; } return false ; }
Check if the access token has been revoked .
10,392
public function setupSiteInterfaceLocalization ( Page $ c = null ) { $ app = Facade :: getFacadeApplication ( ) ; $ loc = $ app -> make ( Localization :: class ) ; $ locale = null ; if ( $ c === null ) { $ c = Page :: getCurrentPage ( ) ; } if ( $ c ) { $ pageController = $ c -> getPageController ( ) ; if ( is_callable...
Set the locale associated to the site localization context .
10,393
public static function isEnabled ( ) { $ app = Facade :: getFacadeApplication ( ) ; $ cache = $ app -> make ( 'cache/request' ) ; $ item = $ cache -> getItem ( 'multilingual/enabled' ) ; if ( ! $ item -> isMiss ( ) ) { return $ item -> get ( ) ; } $ item -> lock ( ) ; $ result = false ; if ( $ app -> isInstalled ( ) ) ...
Check if there s some multilingual section .
10,394
private function trackLimit ( ) { ++ $ this -> sent ; if ( $ this -> sent >= $ this -> limit ) { $ this -> sent = 0 ; $ this -> transport -> disconnect ( ) ; } }
Increment the counter of sent messages and disconnect the underlying transport if needed .
10,395
protected function getErrorString ( $ code , $ value , $ default = null ) { if ( array_key_exists ( $ code , $ this -> translatable_errors ) ) { $ resolver = $ this -> translatable_errors [ $ code ] ; if ( $ resolver instanceof Closure ) { return $ resolver ( $ this , $ code , $ value ) ; } else { return $ resolver ; }...
Get an error string given a code and a passed value .
10,396
public function getFormattedMessageBody ( ) { $ msgBody = $ this -> getMessageBody ( ) ; $ txt = Loader :: helper ( 'text' ) ; $ repliedPos = strpos ( $ msgBody , $ this -> getMessageDelimiter ( ) ) ; if ( $ repliedPos > - 1 ) { $ repliedText = substr ( $ msgBody , $ repliedPos ) ; $ messageText = substr ( $ msgBody , ...
Responsible for converting line breaks to br tags perhaps running bbcode as well as making the older replied - to messages gray .
10,397
public function addTracker ( $ tracker , callable $ creator ) { $ this -> creators [ $ tracker ] = $ creator ; $ this -> map [ ] = $ tracker ; if ( isset ( $ this -> trackers [ $ tracker ] ) ) { unset ( $ this -> trackers [ $ tracker ] ) ; } return $ this ; }
Register a custom tracker creator Closure .
10,398
public function tracker ( $ tracker ) { if ( $ cached = array_get ( $ this -> trackers , $ tracker ) ) { return $ cached ; } if ( $ creator = array_get ( $ this -> creators , $ tracker ) ) { $ created = $ this -> app -> call ( $ creator ) ; $ this -> trackers [ $ tracker ] = $ created ; unset ( $ this -> creators [ $ t...
Get a tracker by handle
10,399
public function reconnect ( $ name = null ) { $ this -> disconnect ( $ name = $ name ? : $ this -> getDefaultConnection ( ) ) ; if ( ! isset ( $ this -> connections [ $ name ] ) ) { return $ this -> connection ( $ name ) ; } else { return $ this -> refreshPdoConnections ( $ name ) ; } }
Reconnect to the given database .