idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
10,200
protected function setCategory ( CategoryInterface $ category ) { $ this -> category = $ category ; $ this -> attributeKeysAndControllers = null ; $ this -> csvHeader = null ; return $ this ; }
Set the attribute category to be used to export the data .
10,201
protected function getAttributeKeysAndControllers ( ) { if ( $ this -> attributeKeysAndControllers === null ) { $ list = [ ] ; foreach ( $ this -> category -> getList ( ) as $ attributeKey ) { $ list [ ] = [ $ attributeKey , $ attributeKey -> getController ( ) ] ; } $ this -> attributeKeysAndControllers = $ list ; } re...
Get a list the attribute keys and controllers for the current category .
10,202
private function convertCsvDataForAttributeController ( AttributeController $ attributeController , $ csvData ) { $ result = $ csvData ; if ( $ attributeController instanceof MulticolumnTextExportableAttributeInterface ) { $ attributeHeaders = $ attributeController -> getAttributeTextRepresentationHeaders ( ) ; $ resul...
Convert the data read from CSV to be passed to the attribute controller .
10,203
public function hasActiveSession ( ) { $ cookie = $ this -> app [ 'cookie' ] ; return $ cookie -> has ( $ this -> config -> get ( 'concrete.session.name' ) ) || $ cookie -> has ( 'ccmAuthUserHash' ) ; }
Check if there is an active session .
10,204
public function containsField ( $ field ) { $ identifier = $ field instanceof FieldInterface ? $ field -> getFieldElementName ( ) : $ field ; foreach ( $ this -> getList ( ) as $ error ) { $ field = $ error -> getField ( ) ; if ( is_object ( $ field ) && $ field -> getFieldElementName ( ) == $ identifier ) { return tru...
Does this list contain error associated to a field?
10,205
private function detectFromServer ( $ value ) { $ result = null ; if ( is_string ( $ value ) && preg_match ( '/\bnginx\/(\d+(\.\d+)+)/i' , $ value , $ m ) ) { $ result = $ m [ 1 ] ; } return $ result ; }
Detect from the SERVER_SOFTWARE key of the superglobal server array .
10,206
public function getActionDescription ( ) { $ entityManager = $ this -> getApplication ( ) -> make ( EntityManagerInterface :: class ) ; $ user = $ entityManager -> find ( User :: class , $ this -> notification -> getUserID ( ) ) ; $ actor = null ; $ actorID = $ this -> notification -> getActorID ( ) ; if ( $ actorID ) ...
Build the description for this notification
10,207
protected function getUrlResolver ( ) { if ( ! $ this -> resolver ) { $ this -> resolver = $ this -> getApplication ( ) -> make ( ResolverManagerInterface :: class ) ; } return $ this -> resolver ; }
Resolve the url resolver instance
10,208
public function refreshEntities ( ) { $ metadatas = $ this -> clearCacheAndProxies ( ) ; $ tool = new SchemaTool ( $ this -> entityManager ) ; $ tool -> updateSchema ( $ metadatas , true ) ; }
Clears cache regenerates all proxy classes and updates metadatas in all entity managers
10,209
public function getText ( ) { $ lines = [ ] ; if ( $ this -> error -> has ( ) ) { foreach ( $ this -> error -> getList ( ) as $ error ) { if ( $ error instanceof HtmlAwareErrorInterface && $ error -> messageContainsHtml ( ) ) { $ lines [ ] = strip_tags ( ( string ) $ error ) ; } else { $ lines [ ] = ( string ) $ error ...
Build an plain text string describing the errors .
10,210
protected function uploadZipToTemp ( $ file ) { if ( ! file_exists ( $ file ) ) { throw new Exception ( t ( 'Could not transfer to temp directory - file not found.' ) ) ; } else { $ dir = time ( ) ; copy ( $ file , $ this -> f -> getTemporaryDirectory ( ) . '/' . $ dir . '.zip' ) ; return $ dir ; } }
Moves an uploaded file to the tmp directory .
10,211
protected function install ( $ file , $ inplace = false ) { if ( ! $ inplace ) { $ directory = $ this -> uploadZipToTemp ( $ file ) ; } else { $ directory = $ file ; } $ dir = $ this -> unzip ( $ directory ) ; $ dirFull = $ this -> getArchiveDirectory ( $ dir ) ; $ dirFull = str_replace ( DIRECTORY_SEPARATOR , '/' , $ ...
Installs a zip file from the passed directory .
10,212
public function load ( $ akID ) { $ em = $ this -> getFacadeApplication ( ) -> make ( 'Doctrine\ORM\EntityManager' ) ; $ this -> legacyAttributeKey = $ em -> find ( 'Concrete\Core\Entity\Attribute\Key\LegacyKey' , $ akID ) ; }
In 5 . 7 and earlier if a subclassed Key object called load it was loading the core data of an attribute key . we re going to load that data into an internal legacy key object that we can keep around to pass calls to for attribute keys that incorrectly subclass this Key object .
10,213
protected function dateDiffNoDST ( \ DateTime $ from , \ DateTime $ to ) { $ fromUTC = new \ DateTime ( $ from -> format ( 'Y-m-d\TH:i:s+00:00' ) ) ; $ toUTC = new \ DateTime ( $ to -> format ( 'Y-m-d\TH:i:s+00:00' ) ) ; return $ fromUTC -> diff ( $ toUTC ) ; }
Returns the difference between two DateTime objects without considering DST changes .
10,214
public function add ( $ type , $ key , $ settings = null , $ pkg = null ) { if ( is_string ( $ type ) ) { $ typeFactory = $ this -> application -> make ( TypeFactory :: class ) ; $ type = $ typeFactory -> getByHandle ( $ type ) ; } $ asID = false ; if ( is_array ( $ key ) ) { $ handle = $ key [ 'akHandle' ] ; $ name = ...
Add a new attribute key .
10,215
public function import ( AttributeType $ type , SimpleXMLElement $ element , Package $ package = null ) { $ key = $ this -> createAttributeKey ( ) ; $ loader = $ this -> getImportLoader ( ) ; $ loader -> load ( $ key , $ element ) ; $ controller = $ type -> getController ( ) ; $ settings = $ controller -> importKey ( $...
Import a new attribute key from a SimpleXMLElement instance .
10,216
public function shutdown ( $ options = [ ] ) { \ Events :: dispatch ( 'on_shutdown' ) ; if ( $ this -> isInstalled ( ) ) { if ( ! isset ( $ options [ 'jobs' ] ) || $ options [ 'jobs' ] == false ) { $ this -> handleScheduledJobs ( ) ; } foreach ( \ Database :: getConnections ( ) as $ connection ) { $ connection -> close...
Turns off the lights .
10,217
protected function handleScheduledJobs ( ) { $ config = $ this [ 'config' ] ; if ( $ config -> get ( 'concrete.jobs.enable_scheduling' ) ) { $ c = Page :: getCurrentPage ( ) ; if ( $ c instanceof Page && ! $ c -> isAdminArea ( ) ) { $ jobs = Job :: getList ( true ) ; $ auth = Job :: generateAuth ( ) ; $ url = '' ; if (...
If we have job scheduling running through the site we check to see if it s time to go for it .
10,218
public function isInstalled ( ) { if ( $ this -> installed === null ) { if ( ! $ this -> isShared ( 'config' ) ) { throw new Exception ( 'Attempting to check install status before application initialization.' ) ; } $ this -> installed = $ this -> make ( 'config' ) -> get ( 'concrete.installed' ) ; } return $ this -> in...
Returns true if concrete5 is installed false if it has not yet been .
10,219
public function checkPageCache ( \ Concrete \ Core \ Http \ Request $ request ) { $ library = PageCache :: getLibrary ( ) ; if ( $ library -> shouldCheckCache ( $ request ) ) { $ record = $ library -> getRecord ( $ request ) ; if ( $ record instanceof PageCacheRecord ) { if ( $ record -> validate ( $ request ) ) { retu...
Checks to see whether we should deliver a concrete5 response from the page cache .
10,220
public function handleAutomaticUpdates ( ) { $ config = $ this [ 'config' ] ; $ installed = $ config -> get ( 'concrete.version_db_installed' ) ; $ core = $ config -> get ( 'concrete.version_db' ) ; if ( $ installed < $ core ) { $ this -> make ( MutexInterface :: class ) -> execute ( Update :: MUTEX_KEY , function ( ) ...
Check if the core needs to be updated and if so updates it .
10,221
public function setupPackageAutoloaders ( ) { $ pla = \ Concrete \ Core \ Package \ PackageList :: get ( ) ; $ pl = $ pla -> getPackages ( ) ; $ cl = ClassLoader :: getInstance ( ) ; foreach ( $ pl as $ p ) { \ Config :: package ( $ p ) ; if ( $ p -> isPackageInstalled ( ) ) { $ pkg = $ this -> make ( 'Concrete\Core\Pa...
Register package autoloaders . Has to come BEFORE session calls .
10,222
public function setupPackages ( ) { $ config = $ this [ 'config' ] ; $ loc = Localization :: getInstance ( ) ; $ entityManager = $ this [ 'Doctrine\ORM\EntityManager' ] ; $ configUpdater = new EntityManagerConfigUpdater ( $ entityManager ) ; foreach ( $ this -> packages as $ pkg ) { if ( $ config -> get ( 'concrete.upd...
Run startup and localization events on any installed packages .
10,223
public function setupFilesystem ( ) { $ config = $ this [ 'config' ] ; if ( ! is_dir ( $ config -> get ( 'concrete.cache.directory' ) ) ) { @ mkdir ( $ config -> get ( 'concrete.cache.directory' ) , $ config -> get ( 'concrete.filesystem.permissions.directory' ) ) ; @ touch ( $ config -> get ( 'concrete.cache.directory...
Ensure we have a cache directory .
10,224
public function handleURLSlashes ( SymfonyRequest $ request , Site $ site ) { $ path = $ request -> getPathInfo ( ) ; if ( $ path && $ path != '/' ) { $ config = $ this -> make ( 'config' ) ; $ trailing_slashes = $ config -> get ( 'concrete.seo.trailing_slash' ) ; if ( ( $ trailing_slashes && substr ( $ path , - 1 ) !=...
Using the configuration value determines whether we need to redirect to a URL with a trailing slash or not .
10,225
public function handleCanonicalURLRedirection ( SymfonyRequest $ r , Site $ site ) { $ globalConfig = $ this [ 'config' ] ; $ siteConfig = $ site -> getConfigRepository ( ) ; if ( $ globalConfig -> get ( 'concrete.seo.redirect_to_canonical_url' ) && $ siteConfig -> get ( 'seo.canonical_url' ) ) { $ requestUri = $ r -> ...
If we have redirect to canonical host enabled we need to honor it here .
10,226
public function getLocalizedStack ( Section $ section , $ cvID = 'RECENT' ) { $ result = null ; $ mySectionID = $ this -> getMultilingualSectionID ( ) ; if ( $ mySectionID !== 0 && $ section -> getCollectionID ( ) == $ mySectionID ) { $ result = $ this ; } else { $ neutralID = ( $ mySectionID === 0 ) ? $ this -> getCol...
Returns the localized version of this stack .
10,227
protected function writeError ( OutputInterface $ output , $ error ) { $ result = [ trim ( $ error -> getMessage ( ) ) ] ; if ( $ output -> isVerbose ( ) ) { $ file = $ error -> getFile ( ) ; if ( $ file ) { $ result [ ] = "File: {$file}" . ( $ error -> getLine ( ) ? ':' . $ error -> getLine ( ) : '' ) ; } } if ( $ out...
Write an exception .
10,228
protected function execute ( InputInterface $ input , OutputInterface $ output ) { if ( ! method_exists ( $ this , 'handle' ) ) { throw new LogicException ( 'You must define the public handle() method in the command implementation.' ) ; } return $ this -> getApplication ( ) -> getConcrete5 ( ) -> call ( [ $ this , 'han...
This method is overridden to pipe execution to the handle method hiding input and output
10,229
public function table ( array $ headers , array $ rows , $ tableStyle = 'default' , array $ columnStyles = [ ] ) { $ this -> output -> table ( $ headers , $ rows , $ tableStyle , $ columnStyles ) ; }
Format input to textual table .
10,230
public function getConcrete5ProfileURL ( $ user ) { $ result = null ; $ binding = $ this -> getBindingForUser ( $ user ) ; if ( $ binding !== null ) { $ concrete5UserID = ( int ) $ binding ; if ( $ concrete5UserID !== 0 ) { $ result = "https://www.concrete5.org/profile/-/view/$concrete5UserID/" ; } } return $ result ; ...
Get the URL of the concrete5 account associated to a user .
10,231
private function getQuestion ( $ row , InputInterface $ input ) { $ definition = $ this -> getDefinition ( ) ; $ row = ( array ) $ row ; $ default = null ; $ mutator = null ; $ key = array_shift ( $ row ) ; if ( $ row ) { $ default = array_shift ( $ row ) ; } if ( is_callable ( $ default ) ) { $ mutator = $ default ; $...
Do some procedural work to a row in the wizard step list to turn it into a proper question .
10,232
private function getWizard ( InputInterface $ input , OutputInterface $ output , $ firstKey = null ) { $ questions = $ this -> wizardSteps ( ) ; $ tryAgain = false ; $ result = null ; foreach ( $ questions as $ question ) { if ( ! $ firstKey && $ question instanceof \ Closure ) { $ result = $ question ( $ input , $ out...
A wizard generator .
10,233
private function getQuestionString ( InputOption $ option , $ default ) { if ( '' !== ( string ) $ default ) { if ( stripos ( $ option -> getName ( ) , 'password' ) !== false ) { return sprintf ( '%s? [<options=bold>HIDDEN</>]: ' , $ option -> getDescription ( ) , $ default ) ; } return sprintf ( '%s? [<options=bold>%s...
Take an option and return a question string .
10,234
public function createClient ( $ name , $ redirect , array $ scopes , $ key , $ secret ) { $ client = $ this -> app -> make ( Client :: class ) ; $ client -> setName ( $ name ) ; $ client -> setRedirectUri ( $ redirect ) ; $ client -> setClientKey ( $ key ) ; $ client -> setClientSecret ( $ secret ) ; $ id = $ this -> ...
Create a new OAuth client object and provide it a proper UUID
10,235
protected function generateString ( $ length ) { $ bytes = ceil ( $ length / 2 ) ; $ string = bin2hex ( random_bytes ( $ bytes ) ) ; return substr ( $ string , 0 , $ length ) ; }
Generate a cryptographically secure strig
10,236
public function getOutput ( $ request = null ) { $ pl = $ this -> getPageListObject ( ) ; $ link = false ; if ( $ this -> cParentID ) { $ parent = Page :: getByID ( $ this -> cParentID ) ; $ link = $ parent -> getCollectionLink ( ) ; } else { $ link = \ URL :: to ( '/' ) ; } $ pagination = $ pl -> getPagination ( ) ; $...
Get the feed output in RSS form given a Request object .
10,237
public function cancel ( Progress $ wp ) { $ ui = UserInfo :: getByID ( $ this -> getRequestedUserID ( ) ) ; $ wpr = parent :: cancel ( $ wp ) ; $ wpr -> message = t ( "User deletion request has been cancelled." ) ; return $ wpr ; }
After canceling delete request do nothing
10,238
protected function initializeLegacyURLDefinitions ( ) { if ( ! defined ( 'BASE_URL' ) ) { $ resolver = $ this -> getUrlResolver ( ) ; try { $ url = rtrim ( ( string ) $ resolver -> resolve ( [ ] ) , '/' ) ; define ( 'BASE_URL' , $ url ) ; } catch ( Exception $ x ) { return Response :: create ( $ x -> getMessage ( ) , 5...
Define the base url if not defined This will define BASE_URL to whatever is resolved from the resolver .
10,239
protected function setSystemLocale ( ) { $ u = new User ( ) ; $ lan = $ u -> getUserLanguageToDisplay ( ) ; $ loc = Localization :: getInstance ( ) ; $ loc -> setContextLocale ( Localization :: CONTEXT_UI , $ lan ) ; }
Initialize localization .
10,240
protected function registerLegacyConfigValues ( ) { $ config = $ this -> getConfig ( ) ; $ name = $ this -> getSiteService ( ) -> getSite ( ) -> getSiteName ( ) ; $ config -> set ( 'concrete.site' , $ name ) ; }
Set legacy config values This sets concrete . site to the current site s sitename .
10,241
protected function handleUpdates ( ) { $ config = $ this -> app -> make ( 'config' ) ; if ( ! $ config -> get ( 'concrete.maintenance_mode' ) ) { try { $ this -> app -> handleAutomaticUpdates ( ) ; } catch ( MutexBusyException $ x ) { if ( $ x -> getMutexKey ( ) !== Update :: MUTEX_KEY ) { throw $ x ; } $ config -> set...
Update automatically .
10,242
protected function trySteps ( array $ steps ) { foreach ( $ steps as $ step ) { if ( $ result = $ this -> $ step ( ) ) { return $ result ; } } return null ; }
Try a list of steps . If a response is returned halt progression and return the response ; .
10,243
public function getPermissionAssignmentObject ( ) { $ targ = Core :: make ( '\Concrete\Core\Permission\Assignment\ConversationAssignment' ) ; if ( is_object ( $ this -> permissionObject ) ) { $ targ -> setPermissionObject ( $ this -> permissionObject ) ; } $ targ -> setPermissionKeyObject ( $ this ) ; return $ targ ; }
We need this because we don t always have a permission object
10,244
public static function getMySets ( $ user = false ) { $ app = Facade :: getFacadeApplication ( ) ; if ( $ user === false ) { $ user = $ app -> make ( User :: class ) ; } $ database = $ app -> make ( 'database' ) -> connection ( ) ; $ fileSets = array ( ) ; $ queryBuilder = $ database -> createQueryBuilder ( ) ; $ resul...
Returns all sets currently available to the User
10,245
public static function createAndGetSet ( $ fs_name , $ fs_type , $ fs_uid = false ) { if ( $ fs_uid === false ) { $ u = new User ( ) ; $ fs_uid = $ u -> uID ; } $ db = Database :: connection ( ) ; $ criteria = array ( $ fs_name , $ fs_type , $ fs_uid ) ; $ fsID = $ db -> fetchColumn ( 'SELECT fsID FROM FileSets WHERE f...
Creats a new fileset if set doesn t exists .
10,246
public static function getByID ( $ fsID ) { $ db = Database :: connection ( ) ; $ row = $ db -> fetchAssoc ( 'SELECT * FROM FileSets WHERE fsID = ?' , array ( $ fsID ) ) ; if ( is_array ( $ row ) ) { $ fs = new static ( ) ; $ fs = array_to_object ( $ fs , $ row ) ; if ( $ row [ 'fsType' ] == static :: TYPE_SAVED_SEARCH...
Get a file set object by a file set s id .
10,247
public static function create ( $ setName , $ fsOverrideGlobalPermissions = 0 , $ u = false , $ type = self :: TYPE_PUBLIC ) { if ( is_object ( $ u ) && $ u -> isRegistered ( ) ) { $ uID = $ u -> getUserID ( ) ; } else { if ( $ u ) { $ uID = $ u ; } else { $ uID = 0 ; } } $ db = Database :: connection ( ) ; $ db -> ins...
Adds a File set .
10,248
public static function getFilesBySetID ( $ fsID ) { if ( intval ( $ fsID ) > 0 ) { $ fileset = self :: getByID ( $ fsID ) ; if ( $ fileset instanceof \ Concrete \ Core \ File \ Set \ Set ) { return $ fileset -> getFiles ( ) ; } } }
Static method to return an array of File objects by the set id .
10,249
public static function getFilesBySetName ( $ fsName , $ uID = false ) { if ( ! empty ( $ fsName ) ) { $ fileset = self :: getByName ( $ fsName , $ uID ) ; if ( $ fileset instanceof \ Concrete \ Core \ File \ Set \ Set ) { return $ fileset -> getFiles ( ) ; } } }
Static method to return an array of File objects by the set name .
10,250
public static function getByName ( $ fsName , $ uID = false ) { $ db = Database :: connection ( ) ; if ( $ uID !== false ) { $ row = $ db -> fetchAssoc ( 'SELECT * FROM FileSets WHERE fsName = ? AND uID = ?' , array ( $ fsName , $ uID ) ) ; } else { $ row = $ db -> fetchAssoc ( 'SELECT * FROM FileSets WHERE fsName = ?'...
Get a file set object by a file name .
10,251
public function getFiles ( ) { if ( ! $ this -> fileSetFiles ) { $ this -> populateFiles ( ) ; } $ files = array ( ) ; foreach ( $ this -> fileSetFiles as $ file ) { $ files [ ] = ConcreteFile :: getByID ( $ file -> fID ) ; } return $ files ; }
Returns an array of File objects from the current set .
10,252
public function update ( $ setName ) { $ db = Database :: connection ( ) ; $ db -> update ( 'FileSets' , array ( 'fsName' => $ setName ) , array ( 'fsID' => $ this -> fsID ) ) ; return static :: getByID ( $ this -> fsID ) ; }
Updates a file set .
10,253
public function addFileToSet ( $ f_id ) { $ app = Application :: getFacadeApplication ( ) ; if ( is_object ( $ f_id ) ) { $ f = $ f_id ; if ( $ f instanceof FileEntity ) { $ file = $ f ; $ fileVersion = $ file -> getApprovedVersion ( ) ; } else { $ fileVersion = $ f ; $ file = $ fileVersion -> getFile ( ) ; } $ f_id = ...
Adds the file to the set .
10,254
protected function shouldRefreshFileThumbnails ( $ fileOperation ) { $ app = Application :: getFacadeApplication ( ) ; $ em = $ app -> make ( EntityManagerInterface :: class ) ; $ qb = $ em -> createQueryBuilder ( ) ; $ qb -> select ( 'ft.ftTypeID' ) -> from ( ThumbnailType :: class , 'ft' ) -> innerJoin ( 'ft.ftAssoci...
Check if we should build the thumbnails for files added or removed to this file set should .
10,255
public static function authenticateRequest ( $ auth ) { $ val = \ Core :: make ( 'config/database' ) -> get ( 'concrete.security.token.jobs' ) . ':' . DIRNAME_JOBS ; if ( md5 ( $ val ) == $ auth ) { return true ; } }
or from the dashboard
10,256
public static function getAvailableList ( $ includeConcreteDirJobs = 1 ) { $ jobObjs = array ( ) ; $ existingJobHandles = array ( ) ; $ existingJobs = static :: getList ( ) ; foreach ( $ existingJobs as $ j ) { $ existingJobHandles [ ] = $ j -> getJobHandle ( ) ; } if ( ! $ includeConcreteDirJobs ) { $ jobClassLocation...
Scan job directories for job classes
10,257
public function enableAreaLayoutCustomColumnWidths ( ) { $ db = Loader :: db ( ) ; $ db -> Execute ( 'update AreaLayouts set arLayoutIsCustom = ? where arLayoutID = ?' , array ( 1 , $ this -> arLayoutID ) ) ; $ this -> arLayoutIsCustom = true ; }
Enable custom column widths on layouts .
10,258
public function disableAreaLayoutCustomColumnWidths ( ) { $ db = Loader :: db ( ) ; $ db -> Execute ( 'update AreaLayouts set arLayoutIsCustom = ? where arLayoutID = ?' , array ( 0 , $ this -> arLayoutID ) ) ; $ this -> arLayoutIsCustom = false ; }
Disable custom column widths on layouts .
10,259
public function functionAvailable ( $ functionName ) { $ result = false ; if ( is_string ( $ functionName ) ) { $ functionName = trim ( $ functionName ) ; if ( $ functionName !== '' ) { if ( function_exists ( $ functionName ) ) { $ disabledFunctions = $ this -> getDisabledFunctions ( ) ; if ( ! in_array ( strtolower ( ...
Check if a function exists and is not disabled .
10,260
public function hasAddTemplate ( ) { $ bv = new BlockView ( $ this ) ; $ path = $ bv -> getBlockPath ( FILENAME_BLOCK_ADD ) ; if ( file_exists ( $ path . '/' . FILENAME_BLOCK_ADD ) ) { return true ; } return false ; }
Determines if the block type has templates available .
10,261
public function getBlockTypeComposerTemplates ( ) { $ btHandle = $ this -> getBlockTypeHandle ( ) ; $ files = array ( ) ; $ fh = Loader :: helper ( 'file' ) ; $ dir = DIR_FILES_BLOCK_TYPES . "/{$btHandle}/" . DIRNAME_BLOCK_TEMPLATES_COMPOSER ; if ( is_dir ( $ dir ) ) { $ files = array_merge ( $ files , $ fh -> getDirec...
gets the available composer templates used for editing instances of the BlockType while in the composer ui in the dashboard .
10,262
public function getBlockTypeClass ( ) { return \ Concrete \ Core \ Block \ BlockType \ BlockType :: getBlockTypeMappedClass ( $ this -> getBlockTypeHandle ( ) , $ this -> getPackageHandle ( ) ) ; }
Returns the class for the current block type .
10,263
public function getBlockTypeSets ( ) { $ db = Loader :: db ( ) ; $ list = array ( ) ; $ r = $ db -> Execute ( 'select btsID from BlockTypeSetBlockTypes where btID = ? order by displayOrder asc' , array ( $ this -> getBlockTypeID ( ) ) ) ; while ( $ row = $ r -> FetchRow ( ) ) { $ list [ ] = BlockTypeSet :: getByID ( $ ...
Returns an array of all BlockTypeSet objects that this block is in .
10,264
public function getCount ( $ ignoreUnapprovedVersions = false ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ now = $ app -> make ( 'date' ) -> getOverridableNow ( ) ; if ( $ ignoreUnapprovedVersions ) { $ count = $ db -> GetOne ( <<<'EOT'SELECT count(btID)FROM ...
Returns the number of unique instances of this block throughout the entire site note - this count could include blocks in areas that are no longer rendered by the theme .
10,265
public function getBlockTypeCustomTemplates ( Block $ b ) { $ btHandle = $ this -> getBlockTypeHandle ( ) ; $ fh = Loader :: helper ( 'file' ) ; $ files = array ( ) ; $ dir = DIR_FILES_BLOCK_TYPES . "/{$btHandle}/" . DIRNAME_BLOCK_TEMPLATES ; if ( is_dir ( $ dir ) ) { $ files = array_merge ( $ files , $ fh -> getDirect...
Gets the custom templates available for the current BlockType .
10,266
public function refresh ( ) { $ app = Facade :: getFacadeApplication ( ) ; $ db = $ app -> make ( 'database' ) -> connection ( ) ; $ pkgHandle = false ; if ( $ this -> pkgID > 0 ) { $ pkgHandle = $ this -> getPackageHandle ( ) ; } $ class = \ Concrete \ Core \ Block \ BlockType \ BlockType :: getBlockTypeMappedClass ( ...
refreshes the BlockType s database schema throws an Exception if error .
10,267
public function delete ( ) { $ db = Loader :: db ( ) ; $ r = $ db -> Execute ( 'select cID, cvID, b.bID, arHandle from CollectionVersionBlocks cvb inner join Blocks b on b.bID = cvb.bID where btID = ? union select cID, cvID, cvb.bID, arHand...
Removes the block type . Also removes instances of content .
10,268
public function add ( $ data , $ c = false , $ a = false ) { $ app = Facade :: getFacadeApplication ( ) ; $ db = $ app -> make ( 'database' ) -> connection ( ) ; $ u = new User ( ) ; if ( isset ( $ data [ 'uID' ] ) ) { $ uID = $ data [ 'uID' ] ; } else { $ uID = $ u -> getUserID ( ) ; } $ bName = '' ; if ( isset ( $ da...
Adds a block to the system without adding it to a collection . Passes page and area data along if it is available however .
10,269
protected function addOutputAssetAt ( $ item , $ position ) { if ( ! isset ( $ this -> outputAssets [ $ position ] ) ) { $ this -> outputAssets [ $ position ] = [ $ item ] ; } elseif ( ! in_array ( $ item , $ this -> outputAssets [ $ position ] ) ) { $ this -> outputAssets [ $ position ] [ ] = $ item ; } }
Add an asset at a specific position .
10,270
public function getAssetsToOutput ( ) { $ assets = $ this -> getRequiredAssetsToOutput ( ) ; foreach ( $ assets as $ asset ) { $ this -> addOutputAsset ( $ asset ) ; } $ outputAssetsPre = array ( ) ; $ outputAssets = array ( ) ; foreach ( $ this -> outputAssets as $ position => $ assets ) { $ outputAssetsPre [ $ positi...
Get a list of assets that need to be outputted .
10,271
public function markAssetAsIncluded ( $ assetType , $ assetHandle = false ) { $ list = AssetList :: getInstance ( ) ; if ( $ assetType && $ assetHandle ) { $ asset = $ list -> getAsset ( $ assetType , $ assetHandle ) ; } else { $ assetGroup = $ list -> getAssetGroup ( $ assetType ) ; } if ( isset ( $ assetGroup ) ) { $...
Notes in the current request that a particular asset has already been provided .
10,272
public function getRequiredAssetsToOutput ( ) { $ required = $ this -> requiredAssetGroup -> getAssetPointers ( ) ; $ assetPointers = array_filter ( $ required , array ( '\Concrete\Core\Http\ResponseAssetGroup' , 'filterProvidedAssets' ) ) ; $ assets = array ( ) ; $ al = AssetList :: getInstance ( ) ; foreach ( $ asset...
Returns only assets that are required but that aren t also in the providedAssetGroup .
10,273
public function setAttribute ( $ ak , $ value ) { $ orm = \ Database :: connection ( ) -> getEntityManager ( ) ; $ this -> clearAttribute ( $ ak ) ; $ attributeValue = $ this -> getAttributeValueObject ( $ ak , true ) ; $ orm -> persist ( $ attributeValue ) ; $ orm -> flush ( ) ; $ genericValue = new Value ( ) ; $ gene...
Sets the attribute of a user info object to the specified value and saves it in the database .
10,274
private function doGetAction ( $ repository , $ item ) { $ this -> output -> writeln ( $ this -> serialize ( $ repository -> get ( $ item ) ) ) ; }
Complete a requested get action
10,275
private function doSetAction ( Repository $ repository , $ item ) { if ( ! $ this -> hasArgument ( 'value' ) ) { $ this -> output -> error ( 'A value must be provided when using the "set" action.' ) ; } $ value = $ this -> argument ( 'value' ) ; $ repository -> save ( $ item , $ this -> unserialize ( $ value ) ) ; }
Complete a requested set action
10,276
public function reindexAll ( $ fullReindex = false ) { Cache :: disableAll ( ) ; $ indexStack = Application :: getFacadeApplication ( ) -> make ( IndexManagerInterface :: class ) ; $ db = Loader :: db ( ) ; if ( $ fullReindex ) { $ db -> Execute ( "truncate table PageSearchIndex" ) ; } $ pl = new PageList ( ) ; $ pl ->...
Reindexes the search engine .
10,277
public function profileLoader ( ) { $ idTokenString = null ; $ token = $ this -> service -> getStorage ( ) -> retrieveAccessToken ( $ this -> service -> service ( ) ) ; if ( $ token instanceof StdOAuth2Token ) { $ idTokenString = array_get ( $ token -> getExtraParams ( ) , 'id_token' ) ; } if ( ! $ idTokenString ) { re...
Load the external concrete5 profile either from id_token or through the API
10,278
public function getIterator ( ) { $ db = $ this -> manager -> connection ( ) ; if ( ! $ this -> lockColumnsExist ( $ db ) ) { return ; } $ qb = $ db -> createQueryBuilder ( ) ; $ nextQuery = $ this -> getNextQuery ( $ qb ) ; $ try = 10 ; while ( $ next = $ this -> next ( $ nextQuery ) ) { unset ( $ next [ $ this -> loc...
Get an iterator that outputs locked thumbnail rows
10,279
private function next ( QueryBuilder $ nextQuery ) { $ now = new \ DateTime ( 'now' ) ; $ qb = clone $ nextQuery ; $ qb -> setParameter ( ':currentTime' , $ now -> format ( 'Y-m-d H:i:s' ) ) ; return $ qb -> execute ( ) -> fetch ( ) ; }
Get the next matching thumbnail path row
10,280
private function reserveNext ( array $ next , Connection $ db ) { $ lockID = $ this -> getLockID ( ) ; try { $ date = new \ DateTime ( 'now' ) ; $ date -> setTimestamp ( $ date -> getTimestamp ( ) + $ this -> timeout ) ; if ( ! $ db -> update ( $ this -> table , [ $ this -> lockColumn => $ lockID , $ this -> lockTimeou...
Mark the next item as reserved
10,281
private function matchingLock ( $ lockID , array $ next , Connection $ db ) { $ qb = $ db -> createQueryBuilder ( ) ; $ select = $ qb -> select ( '*' ) -> from ( $ this -> table , 't' ) -> where ( $ qb -> expr ( ) -> eq ( $ this -> lockColumn , $ qb -> expr ( ) -> literal ( $ lockID ) ) ) ; $ predicates = array_map ( f...
Find the row matching the passed criteria This is used to verify that we ve successfully locked a row in the database .
10,282
private function lockColumnsExist ( Connection $ db ) { $ schema = $ db -> getSchemaManager ( ) -> listTableColumns ( $ this -> table ) ; return isset ( $ schema [ 'lockid' ] ) ; }
Check if the required lock columns have been added to the database . This prevents people upgrading from seeing 500 errors in their logs .
10,283
private function getLockID ( ) { if ( $ this -> lockID ) { return $ this -> lockID ; } $ id = uniqid ( 'thumbnail_thread_' , true ) ; $ this -> lockID = $ id ; return $ id ; }
Get and memoize the current lock ID
10,284
public static function getByHandle ( $ btHandle ) { $ result = null ; $ btHandle = ( string ) $ btHandle ; if ( $ btHandle !== '' ) { $ app = Application :: getFacadeApplication ( ) ; $ em = $ app -> make ( EntityManagerInterface :: class ) ; $ repo = $ em -> getRepository ( BlockTypeEntity :: class ) ; $ result = $ re...
Get a BlockType given its handle .
10,285
public static function getByID ( $ btID ) { $ result = null ; $ btID = ( int ) $ btID ; if ( $ btID !== 0 ) { $ app = Application :: getFacadeApplication ( ) ; $ em = $ app -> make ( EntityManagerInterface :: class ) ; $ result = $ em -> find ( BlockTypeEntity :: class , $ btID ) ; if ( $ result !== null ) { $ result -...
Get a BlockType given its ID .
10,286
public static function installBlockType ( $ btHandle , $ pkg = false ) { $ app = Application :: getFacadeApplication ( ) ; $ em = $ app -> make ( EntityManagerInterface :: class ) ; $ pkgHandle = ( string ) ( is_object ( $ pkg ) ? $ pkg -> getPackageHandle ( ) : $ pkg ) ; $ class = static :: getBlockTypeMappedClass ( $...
Install a BlockType that is passed via a btHandle string . The core or override directories are parsed .
10,287
public static function getBlockTypeMappedClass ( $ btHandle , $ pkgHandle = false ) { $ app = Application :: getFacadeApplication ( ) ; $ txt = $ app -> make ( 'helper/text' ) ; $ pkgHandle = ( string ) $ pkgHandle ; $ locator = $ app -> make ( FileLocator :: class ) ; if ( $ pkgHandle !== '' ) { $ locator -> addLocati...
Return the class file that this BlockType uses .
10,288
public static function clearCache ( ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ sm = $ db -> getSchemaManager ( ) ; $ tableNames = array_map ( 'strtolower' , $ sm -> listTableNames ( ) ) ; if ( in_array ( 'config' , $ tableNames , true ) ) { $ platform = $ db -...
Clears output and record caches .
10,289
public function installMissingPackageTranslations ( Package $ package ) { $ wanted = Localization :: getAvailableInterfaceLanguages ( ) ; $ siteService = $ this -> app -> make ( SiteService :: class ) ; $ site = $ siteService -> getSite ( ) ; if ( $ site ) { foreach ( $ site -> getLocales ( ) as $ locale ) { $ wanted [...
Install missing package translation files .
10,290
protected function getDefaultSubscription ( ) { if ( ! $ this -> defaultSubscription ) { $ this -> defaultSubscription = $ this -> app -> make ( StandardSubscription :: class , [ self :: IDENTIFIER , t ( 'User Deactivated' ) ] ) ; } return $ this -> defaultSubscription ; }
Get the default subscription object . If one was not passed in at construct time create one now
10,291
public function getAvailableFilters ( ) { if ( ! $ this -> defaultFilter ) { $ this -> defaultFilter = $ this -> app -> make ( StandardFilter :: class , [ $ this , self :: IDENTIFIER , t ( 'User Deactivated' ) , 'userdeactivatednotification' ] ) ; } return [ $ this -> defaultFilter ] ; }
Get available notification filters
10,292
public static function addGlobal ( $ cPath , $ pkg = null ) { $ pathToFile = static :: getPathToNode ( $ cPath , $ pkg ) ; $ txt = Loader :: helper ( 'text' ) ; $ c = CorePage :: getByPath ( $ cPath ) ; if ( $ c -> isError ( ) && $ c -> getError ( ) == COLLECTION_NOT_FOUND ) { $ data = array ( ) ; $ data [ 'handle' ] =...
Adds a single page outside of any site trees . The global = true declaration in content importer XML must come at on the first URL segment so we don t have to be smart and check to see if the parents already eixst .
10,293
public static function getList ( ) { $ db = Loader :: db ( ) ; $ r = $ db -> query ( "select Pages.cID from Pages inner join Collections on Pages.cID = Collections.cID where cFilename is not null order by cDateModified desc" ) ; $ pages = array ( ) ; while ( $ row = $ r -> fetchRow ( ) ) { $ c = Page :: getByID ( $ row...
returns all pages in the site that are single
10,294
public static function getAccessEntitiesForUser ( $ user ) { $ entities = [ ] ; if ( $ user -> isRegistered ( ) ) { $ ingids = [ ] ; $ app = Facade :: getFacadeApplication ( ) ; $ database = $ app -> make ( 'database' ) -> connection ( ) ; foreach ( $ user -> getUserGroups ( ) as $ key => $ val ) { $ ingids [ ] = $ key...
Returns all GroupCombination Access Entities for the provided user .
10,295
public static function getOrCreate ( $ groups ) { $ app = Facade :: getFacadeApplication ( ) ; $ database = $ app -> make ( 'database' ) -> connection ( ) ; $ petID = $ database -> fetchColumn ( 'select petID from PermissionAccessEntityTypes where petHandle = \'group_combination\'' ) ; $ query = $ ...
Function used to get or create a GroupCombination Permission Access Entity .
10,296
public function getAccessEntityUsers ( PermissionAccess $ pa ) { $ userList = new UserList ( ) ; $ userList -> ignorePermissions ( ) ; foreach ( $ this -> groups as $ g ) { $ userList -> filterByGroupID ( $ g -> getGroupID ( ) ) ; } return $ userList -> getResults ( ) ; }
Get the users who have access to this GroupCombination .
10,297
public function load ( ) { $ app = Facade :: getFacadeApplication ( ) ; $ database = $ app -> make ( 'database' ) -> connection ( ) ; $ gIDs = $ database -> fetchAll ( 'select gID from PermissionAccessEntityGroups where peID = ? order by gID asc' , [ $ this -> peID ] ) ; if ( $ gIDs && is_array ( $ gIDs ) ) ...
Function used to load the properties for this GroupCombinationEntity from the database .
10,298
public function askWithCompletion ( $ question , array $ choices , $ default = null , $ attempts = null , $ strict = false ) { $ question = new Question ( $ question , $ default ) ; $ question -> setMaxAttempts ( $ attempts ) -> setAutocompleterValues ( $ choices ) ; if ( $ strict ) { $ question -> setValidator ( funct...
Ask a question with autocompletion
10,299
public function columns ( array $ values , $ width = 5 , $ tableStyle = 'compact' , array $ columnStyles = [ ] ) { $ table = new Table ( $ this ) ; $ table -> setHeaders ( [ ] ) -> setRows ( iterator_to_array ( $ this -> chunk ( $ values , $ width ) ) ) -> setStyle ( $ tableStyle ) ; foreach ( $ columnStyles as $ colum...
Output in even width columns