idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
10,400
public function getLanguageText ( $ locale = null ) { try { $ text = PunicLanguage :: getName ( $ this -> getLanguage ( ) , $ locale ? : '' ) ; } catch ( Exception $ e ) { $ text = $ this -> getLanguage ( ) ; } catch ( Throwable $ e ) { $ text = $ this -> getLanguage ( ) ; } return $ text ; }
Get the display name of this locale .
10,401
protected function triggerRequest ( \ PermissionKey $ pk ) { if ( ! $ this -> wrID ) { $ this -> save ( ) ; } if ( ! $ pk -> canPermissionKeyTriggerWorkflow ( ) ) { throw new \ Exception ( t ( 'This permission key cannot start a workflow.' ) ) ; } $ pa = $ pk -> getPermissionAccessObject ( ) ; $ skipWorkflow = true ; i...
Triggers a workflow request queries a permission key to see what workflows are attached to it and initiates them .
10,402
public function getPlainTextValue ( ) { $ controller = $ this -> getController ( ) ; if ( method_exists ( $ controller , 'getPlainTextValue' ) ) { return $ controller -> getPlainTextValue ( ) ; } if ( $ this -> getValueObject ( ) ) { return ( string ) $ this -> getValueObject ( ) ; } if ( method_exists ( $ controller ,...
Returns content that is useful in plain text contexts .
10,403
private function transformEntry ( Entry \ EntryInterface $ entry ) { return [ 'id' => $ entry -> getID ( ) , 'name' => $ entry -> getLabel ( ) , 'icon' => ( string ) $ entry -> getIcon ( ) ] ; }
Convert an entry to an array
10,404
protected function checkEmail ( $ mixed ) { $ result = false ; if ( is_string ( $ mixed ) && $ mixed !== '' ) { $ eev = $ this -> getEguliasEmailValidator ( ) ; $ testMX = $ this -> isTestMXRecord ( ) ; if ( $ eev -> isValid ( $ mixed , $ testMX , $ this -> isStrict ( ) ) ) { if ( $ testMX ) { $ result = ! in_array ( E...
Actually check if an email address is valid .
10,405
public function getTrailToCollection ( $ c ) { $ db = Database :: connection ( ) ; $ cArray = array ( ) ; $ currentcParentID = $ c -> getCollectionParentID ( ) ; if ( $ currentcParentID > 0 ) { while ( is_numeric ( $ currentcParentID ) && $ currentcParentID > 0 && $ currentcParentID ) { $ q = "select cID, cParentID fro...
Returns an array of collections as a breadcrumb to the current page .
10,406
public static function clear ( $ file = null ) { if ( static :: hasEAccelerator ( ) ) { if ( function_exists ( 'eeaccelerator_clear' ) ) { $ paths = @ ini_get ( 'eaccelerator.allowed_admin_path' ) ; if ( is_string ( $ paths ) && ( $ paths !== '' ) ) { $ myPath = str_replace ( DIRECTORY_SEPARATOR , '/' , __DIR__ ) ; for...
Clear the opcache .
10,407
public function deactivated ( DeactivateUser $ event ) { $ type = $ this -> notificationManager -> driver ( UserDeactivatedType :: IDENTIFIER ) ; $ notifier = $ type -> getNotifier ( ) ; if ( method_exists ( $ notifier , 'notify' ) ) { $ subscription = $ type -> getSubscription ( $ event ) ; $ users = $ notifier -> get...
Handle deactivated user events
10,408
public static function getResponse ( $ object ) { $ cache = Core :: make ( 'cache/request' ) ; $ identifier = sprintf ( 'permission/response/%s/%s' , get_class ( $ object ) , $ object -> getPermissionObjectIdentifier ( ) ) ; $ item = $ cache -> getItem ( $ identifier ) ; if ( ! $ item -> isMiss ( ) ) { return $ item ->...
Passing in any object that implements the ObjectInterface retrieve the Permission Response object .
10,409
public function validate ( $ permissionHandle , $ args = array ( ) ) { $ u = new User ( ) ; if ( $ u -> isSuperUser ( ) ) { return true ; } if ( ! is_object ( $ this -> category ) ) { throw new Exception ( t ( 'Unable to get category for permission %s' , $ permissionHandle ) ) ; } $ pk = $ this -> category -> getPermis...
This function returns true if the user has permission to the object or false if they do not have access .
10,410
protected function performSave ( $ args , $ loadExisting = false ) { if ( $ this -> btTable ) { $ db = Database :: connection ( ) ; $ columns = $ db -> MetaColumnNames ( $ this -> btTable ) ; $ this -> record = new BlockRecord ( $ this -> btTable ) ; $ this -> record -> bID = $ this -> bID ; if ( $ loadExisting ) { $ t...
Persist the block options .
10,411
protected function load ( ) { if ( $ this -> btTable ) { if ( $ this -> btCacheBlockRecord && $ this -> btCachedBlockRecord && Config :: get ( 'concrete.cache.blocks' ) ) { $ this -> record = unserialize ( base64_decode ( $ this -> btCachedBlockRecord ) ) ; } else { $ this -> record = new BlockRecord ( $ this -> btTabl...
Loads the BlockRecord class based on its attribute names .
10,412
public function getActionURL ( $ task ) { try { if ( is_object ( $ this -> block ) ) { if ( is_object ( $ this -> block -> getProxyBlock ( ) ) ) { $ b = $ this -> block -> getProxyBlock ( ) ; } else { $ b = $ this -> block ; } $ action = $ this -> getAction ( ) ; if ( $ action === 'view' || strpos ( $ action , 'action_...
Creates a URL that can be posted or navigated to that when done so will automatically run the corresponding method inside the block s controller . It can also be used to perform system operations accordingly to the current action .
10,413
public function getBlockObject ( ) { if ( is_object ( $ this -> block ) ) { return $ this -> block ; } return Block :: getByID ( $ this -> bID ) ; }
Gets the generic Block object attached to this controller s instance .
10,414
public function delete ( ) { if ( $ this -> bID > 0 ) { if ( $ this -> btTable ) { $ ni = new BlockRecord ( $ this -> btTable ) ; $ ni -> bID = $ this -> bID ; $ ni -> Load ( 'bID=' . $ this -> bID ) ; $ ni -> delete ( ) ; } } }
Automatically run when a block is deleted . This removes the special data from the block s specific database table . If a block needs to do more than this this method should be overridden .
10,415
protected function setViewHelpers ( ) { $ this -> set ( 'token' , $ this -> app -> make ( 'token' ) ) ; $ this -> set ( 'form' , $ this -> app -> make ( 'helper/form' ) ) ; $ this -> set ( 'ui' , $ this -> app -> make ( 'helper/concrete/ui' ) ) ; $ this -> set ( 'resolverManager' , $ this -> app -> make ( ResolverManag...
Set the helpers for the view .
10,416
protected function setViewSets ( ) { $ config = $ this -> app -> make ( 'config' ) ; $ this -> set ( 'formID' , 'ccm-file-manager-import-files-' . $ this -> app -> make ( Identifier :: class ) -> getString ( 32 ) ) ; $ this -> set ( 'currentFolder' , $ this -> getCurrentFolder ( ) ) ; $ this -> set ( 'originalPage' , $...
Set the variables for the view .
10,417
protected function getCurrentFolder ( ) { if ( $ this -> currentFolder === false ) { $ currentFolder = null ; $ fID = $ this -> request -> request -> get ( 'currentFolder' , $ this -> request -> query -> get ( 'currentFolder' ) ) ; if ( $ fID && is_scalar ( $ fID ) ) { $ fID = ( int ) $ fID ; if ( $ fID !== 0 ) { $ nod...
Get the current folder .
10,418
protected function setCurrentFolder ( FileFolder $ value = null ) { if ( $ value !== $ this -> currentFolder ) { $ this -> currentFolder = $ value ; $ this -> currentFolderPermissions = null ; } return $ this ; }
Set the current folder .
10,419
protected function getCurrentFolderPermissions ( ) { if ( $ this -> currentFolderPermissions === null ) { $ folder = $ this -> getCurrentFolder ( ) ; if ( $ folder === null ) { $ folder = $ this -> app -> make ( Filesystem :: class ) -> getRootFolder ( ) ; if ( $ folder === null ) { $ folder = new FileFolder ( ) ; } } ...
Get the permissions for the current folder .
10,420
protected function getOriginalPage ( ) { if ( $ this -> originalPage === false ) { $ originalPage = null ; $ ocID = $ this -> request -> request -> get ( 'ocID' , $ this -> request -> query -> get ( 'ocID' ) ) ; if ( $ ocID && is_scalar ( $ ocID ) ) { $ ocID = ( int ) $ ocID ; if ( $ ocID !== 0 ) { $ originalPage = Pag...
Get the page where the file is originally placed on .
10,421
protected function setOriginalPage ( Page $ value = null ) { $ this -> originalPage = $ value === null || $ value -> isError ( ) ? null : $ value ; return $ this ; }
Set the page where the file is originally placed on .
10,422
protected function getAutomaticChunkSize ( ) { $ nh = $ this -> app -> make ( 'helper/number' ) ; $ uploadMaxFilesize = ( int ) $ nh -> getBytes ( ini_get ( 'upload_max_filesize' ) ) - 100 ; $ postMaxSize = ( int ) $ nh -> getBytes ( ini_get ( 'post_max_size' ) ) - 10000 ; if ( $ uploadMaxFilesize < 1 && $ postMaxSize ...
Determine the chunk size for chunked uploads .
10,423
protected function getIncomingFiles ( ) { $ fh = $ this -> app -> make ( 'helper/validation/file' ) ; $ nh = $ this -> app -> make ( 'helper/number' ) ; $ incoming = $ this -> app -> make ( Incoming :: class ) ; $ files = $ incoming -> getIncomingFilesystem ( ) -> listContents ( $ incoming -> getIncomingPath ( ) ) ; fo...
Get the list of files available in the incoming directory .
10,424
public function findByFile ( $ file ) { if ( $ file instanceof File ) { $ file = $ file -> getFileID ( ) ; } return $ this -> findBy ( [ 'file_id' => $ file ] ) ; }
Find usage records related to a file
10,425
public function findByCollection ( $ collection , $ version = null ) { if ( $ collection instanceof Collection ) { $ collection = $ collection -> getCollectionID ( ) ; } $ criteria = [ 'collection_id' => $ collection ] ; if ( $ version && $ version instanceof Version ) { $ version = $ version -> getVersionID ( ) ; } if...
Find FileUsageRecords given a collection and a version
10,426
public function findByBlock ( $ block ) { if ( $ block instanceof Block ) { $ block = $ block -> getBlockID ( ) ; } elseif ( $ block instanceof BlockController ) { $ block = $ block -> getBlockObject ( ) -> getBlockID ( ) ; } return $ this -> findBy ( [ 'block_id' => $ block ] ) ; }
Find FileUsageRecords given a block
10,427
public function register ( ) { $ this -> registerFileConfig ( ) ; $ this -> registerDatabaseConfig ( ) ; $ this -> app -> bind ( 'Concrete\Core\Config\Repository\Repository' , 'config' ) ; $ this -> app -> bind ( 'Illuminate\Config\Repository' , 'Concrete\Core\Config\Repository\Repository' ) ; }
Configuration repositories .
10,428
private function registerFileConfig ( ) { $ this -> app -> singleton ( 'config' , function ( $ app ) { $ loader = $ app -> make ( 'Concrete\Core\Config\FileLoader' ) ; $ saver = $ app -> make ( 'Concrete\Core\Config\FileSaver' ) ; return $ app -> build ( 'Concrete\Core\Config\Repository\Repository' , array ( $ loader ,...
Create a file config repository .
10,429
private function registerDatabaseConfig ( ) { $ this -> app -> bindShared ( 'config/database' , function ( $ app ) { $ loader = $ app -> make ( 'Concrete\Core\Config\DatabaseLoader' ) ; $ saver = $ app -> make ( 'Concrete\Core\Config\DatabaseSaver' ) ; return $ app -> build ( 'Concrete\Core\Config\Repository\Repository...
Create a database config repository .
10,430
public function filter ( $ column , $ value , $ comparison = '=' ) { $ foundFilterIndex = - 1 ; if ( $ column ) { foreach ( $ this -> filters as $ key => $ info ) { if ( $ info [ 0 ] == $ column ) { $ foundFilterIndex = $ key ; break ; } } } if ( $ foundFilterIndex > - 1 ) { $ this -> filters [ $ foundFilterIndex ] = a...
Adds a filter to this item list .
10,431
protected function prepareConfig ( $ config ) { if ( isset ( $ config [ 'loggers' ] ) && is_array ( $ config [ 'loggers' ] ) && array_key_exists ( Channels :: META_CHANNEL_ALL , $ config [ 'loggers' ] ) ) { $ allConfig = $ config [ 'loggers' ] [ Channels :: META_CHANNEL_ALL ] ; $ channels = array_merge ( Channels :: ge...
Takes the config array we re going to pass to monolog cascade and transforms it a bit . For example if we have configuration we need to apply to all channels we loop through all the channels in the channels class and add them to the config array .
10,432
public function filterByExtension ( $ extension ) { $ extensions = is_array ( $ extension ) ? $ extension : [ $ extension ] ; if ( count ( $ extensions ) > 0 ) { $ expr = $ this -> query -> expr ( ) ; $ or = $ expr -> orX ( ) ; foreach ( $ extensions as $ extension ) { $ extension = ltrim ( ( string ) $ extension , '.'...
Filter the files by their extension .
10,433
public function getPath ( ) { $ pathInfo = rawurldecode ( $ this -> getPathInfo ( ) ) ; $ path = '/' . trim ( $ pathInfo , '/' ) ; return ( $ path == '/' ) ? '' : $ path ; }
Returns the full path for a request .
10,434
public static function post ( $ key = null , $ defaultValue = null ) { if ( $ key == null ) { return $ _POST ; } if ( isset ( $ _POST [ $ key ] ) ) { return ( is_string ( $ _POST [ $ key ] ) ) ? trim ( $ _POST [ $ key ] ) : $ _POST [ $ key ] ; } return $ defaultValue ; }
If no arguments are passed returns the post array . If a key is passed it returns the value as it exists in the post array . If a default value is provided and the key does not exist in the POST array the default value is returned .
10,435
public function delete ( ) { $ db = Loader :: db ( ) ; $ v = array ( $ this -> pID ) ; $ q = "delete from Piles where pID = ?" ; $ db -> query ( $ q , $ v ) ; $ q2 = "delete from PileContents where pID = ?" ; $ db -> query ( $ q , $ v ) ; return true ; }
Delete a pile .
10,436
public function isAjaxRequest ( Request $ request ) { $ result = false ; $ requestedWith = $ request -> server -> get ( 'HTTP_X_REQUESTED_WITH' ) ; if ( is_string ( $ requestedWith ) && strcasecmp ( $ requestedWith , 'XMLHttpRequest' ) === 0 ) { $ result = true ; } return $ result ; }
Check if a request is an Ajax call .
10,437
public function sendResult ( $ result ) { if ( @ ob_get_length ( ) ) { @ ob_end_clean ( ) ; } if ( isset ( $ _SERVER [ 'HTTP_ACCEPT' ] ) && strpos ( $ _SERVER [ 'HTTP_ACCEPT' ] , 'application/json' ) !== false ) { header ( 'Content-Type: application/json; charset=' . APP_CHARSET , true ) ; } else { header ( 'Content-Ty...
Sends a result to the client and ends the execution .
10,438
public function sendError ( $ error ) { if ( @ ob_get_length ( ) ) { @ ob_end_clean ( ) ; } if ( $ error instanceof \ Concrete \ Core \ Error \ ErrorList \ ErrorList ) { $ error -> outputJSON ( ) ; } else { header ( $ _SERVER [ 'SERVER_PROTOCOL' ] . ' 400 Bad Request' , true , 400 ) ; header ( 'Content-Type: text/plain...
Sends an error to the client and ends the execution .
10,439
public function containsString ( $ needle , $ haystack = array ( ) , $ recurse = true ) { $ stringHelper = Core :: make ( 'helper/validation/strings' ) ; if ( ! $ stringHelper -> notempty ( $ needle ) ) { return false ; } $ arr = ( ! is_array ( $ haystack ) ) ? array ( $ haystack ) : $ haystack ; foreach ( $ arr as $ i...
Returns true if any string in the haystack contains the needle .
10,440
private function parseKeys ( $ keys ) { if ( is_string ( $ keys ) ) { if ( strpos ( $ keys , '[' ) !== false ) { $ keys = str_replace ( ']' , '' , $ keys ) ; $ keys = explode ( '[' , trim ( $ keys , '[' ) ) ; } else { $ keys = ( array ) $ keys ; } } return $ keys ; }
Turns the string keys into an array of keys .
10,441
public function flatten ( array $ array ) { $ tmp = array ( ) ; foreach ( $ array as $ a ) { if ( is_array ( $ a ) ) { $ tmp = array_merge ( $ tmp , array_flat ( $ a ) ) ; } else { $ tmp [ ] = $ a ; } } return $ tmp ; }
Takes a multidimensional array and flattens it .
10,442
public function sanitizeFile ( $ inputFilename , SanitizerOptions $ options = null , $ outputFilename = '' ) { $ data = is_string ( $ inputFilename ) && $ this -> filesystem -> isFile ( $ inputFilename ) ? $ this -> filesystem -> get ( $ inputFilename ) : false ; if ( $ data === false ) { throw SanitizerException :: cr...
Sanitize a file containing an SVG document .
10,443
public function sanitizeData ( $ data , SanitizerOptions $ options = null ) { $ xml = $ this -> dataToXml ( $ data ) ; if ( $ options === null ) { $ options = new SanitizerOptions ( ) ; } $ this -> processNode ( $ xml -> documentElement , $ options ) ; return $ this -> xmlToData ( $ xml ) ; }
Sanitize a string containing an SVG document .
10,444
protected function getLoadFlags ( ) { $ flags = LIBXML_NONET | LIBXML_NOWARNING ; foreach ( [ 'LIBXML_PARSEHUGE' , 'LIBXML_HTML_NOIMPLIED' , 'LIBXML_HTML_NODEFDTD' , 'LIBXML_BIGLINES' , ] as $ flagName ) { if ( defined ( $ flagName ) ) { $ flags |= constant ( $ flagName ) ; } } return $ flags ; }
Get the flags to be used when loading the XML .
10,445
protected function dataToXml ( $ data ) { if ( ! is_string ( $ data ) ) { throw SanitizerException :: create ( SanitizerException :: ERROR_FAILED_TO_PARSE_XML ) ; } $ xml = new DOMDocument ( ) ; $ error = null ; try { $ loaded = $ xml -> loadXML ( $ data , $ this -> getLoadFlags ( ) ) ; } catch ( Exception $ x ) { $ er...
Create a DOMDocument instance from a string .
10,446
protected function xmlToData ( DOMDocument $ xml ) { $ data = $ xml -> saveXML ( ) ; if ( $ data === false ) { throw SanitizerException :: create ( SanitizerException :: ERROR_FAILED_TO_GENERATE_XML ) ; } return $ data ; }
Render a DOMDocument instance as a string .
10,447
public function getDefaultCharacterSet ( ) { $ characterSet = $ this -> config -> get ( 'database.preferred_character_set' ) ; $ characterSet = $ this -> normalizeCharacterSet ( $ characterSet ) ; return $ characterSet ; }
Get the default character set .
10,448
public function setCharacterSet ( $ characterSet ) { if ( $ characterSet !== null ) { $ characterSet = $ this -> normalizeCharacterSet ( $ characterSet ) ; } $ this -> characterSet = $ characterSet ; return $ this ; }
Set the character set .
10,449
public function getDefaultCollation ( ) { $ collation = $ this -> config -> get ( 'database.preferred_collation' ) ; $ collation = $ this -> normalizeCollation ( $ collation ) ; return $ collation ; }
Get the default collation .
10,450
public function setCollation ( $ collation ) { if ( $ collation !== null ) { $ collation = $ this -> normalizeCollation ( $ collation ) ; } $ this -> collation = $ collation ; return $ this ; }
Set the collation .
10,451
public function resolveCharacterSetAndCollation ( Connection $ connection ) { $ characterSet = $ this -> getCharacterSet ( ) ; $ collation = $ this -> getCollation ( ) ; if ( $ collation !== '' ) { $ collations = $ connection -> getSupportedCollations ( ) ; if ( ! isset ( $ collations [ $ collation ] ) ) { throw new Ex...
Resolve the character set and collation .
10,452
public function getConfiguration ( ) { $ driverChain = $ this -> getMetadataDriverImpl ( ) ; $ this -> configuration -> setMetadataDriverImpl ( $ driverChain ) ; return $ this -> configuration ; }
Add driverChain and get orm config
10,453
public static function questionCleanup ( $ qsID = 0 , $ bID = 0 ) { $ db = Database :: connection ( ) ; $ vals = array ( intval ( $ qsID ) ) ; $ questionsWithBIDs = $ db -> fetchColumn ( 'SELECT count(*) FROM btFormQuestions WHERE bID!=0 AND questionSetId=? ' , $ vals ) ; if ( ! $ questionsWithBIDs ) { $ vals = array (...
Run on Form block edit
10,454
public function save ( $ item , $ value , $ environment , $ group , $ namespace = null ) { $ builder = $ this -> getConnection ( ) -> createQueryBuilder ( ) ; $ query = $ builder -> delete ( 'Config' ) -> where ( 'configNamespace = :namespace' , 'configGroup = :group' , 'configItem LIKE :item' ) -> setParameters ( arra...
Save config item .
10,455
public function view ( $ pThemeID = null , $ message = false ) { if ( ! $ pThemeID ) { $ this -> redirect ( '/dashboard/pages/themes/' ) ; } $ v = Loader :: helper ( 'validation/error' ) ; $ pt = PageTheme :: getByID ( $ pThemeID ) ; if ( is_object ( $ pt ) ) { $ files = $ pt -> getFilesInTheme ( ) ; $ this -> set ( 'f...
grab all the page types from within a theme
10,456
public function createTextIndexes ( array $ textIndexes ) { if ( ! empty ( $ textIndexes ) ) { $ sm = $ this -> getSchemaManager ( ) ; foreach ( $ textIndexes as $ tableName => $ indexes ) { if ( $ sm -> tablesExist ( [ $ tableName ] ) ) { $ existingIndexNames = array_map ( function ( \ Doctrine \ DBAL \ Schema \ Index...
This is essentially a workaround for not being able to define indexes on TEXT fields with the current version of Doctrine DBAL . This feature will be removed when DBAL will support it so don t use this feature .
10,457
public function replace ( $ table , $ fieldArray , $ keyCol , $ autoQuote = true ) { $ qb = $ this -> createQueryBuilder ( ) ; $ qb -> select ( 'count(*)' ) -> from ( $ table , 't' ) ; $ where = $ qb -> expr ( ) -> andX ( ) ; $ updateKeys = [ ] ; if ( ! is_array ( $ keyCol ) ) { $ keyCol = [ $ keyCol ] ; } foreach ( $ ...
Insert or update a row in a database table .
10,458
public function getSupportedCharsets ( ) { if ( $ this -> supportedCharsets === null ) { $ supportedCharsets = [ ] ; $ rs = $ this -> executeQuery ( 'SHOW CHARACTER SET' ) ; while ( ( $ row = $ rs -> fetch ( PDO :: FETCH_ASSOC ) ) !== false ) { if ( ! isset ( $ row [ 'Charset' ] ) || ! isset ( $ row [ 'Default collatio...
Get the supported character sets and associated default collation .
10,459
public function getSupportedCollations ( ) { if ( $ this -> supportedCollations === null ) { $ supportedCollations = [ ] ; $ rs = $ this -> executeQuery ( 'SHOW COLLATION' ) ; while ( ( $ row = $ rs -> fetch ( PDO :: FETCH_ASSOC ) ) !== false ) { if ( ! isset ( $ row [ 'Collation' ] ) || ! isset ( $ row [ 'Charset' ] )...
Get the supported collations and the associated character sets .
10,460
public function isCollationSupportedForKeys ( $ collation , $ fieldLength ) { $ sm = $ this -> getSchemaManager ( ) ; $ existingTables = array_map ( 'strtolower' , $ sm -> listTableNames ( ) ) ; for ( $ i = 0 ; ; ++ $ i ) { $ tableName = 'tmp_checkCollationFieldLength' . $ i ; if ( ! in_array ( strtolower ( $ tableName...
Check if a collation can be used for keys of a specific length .
10,461
private function projectRange ( IPRange $ range ) { $ result = [ $ range -> getIpRange ( ) -> toString ( ) , $ range -> getIpRange ( ) -> getComparableStartString ( ) , $ range -> getIpRange ( ) -> getComparableEndString ( ) , ] ; if ( $ this -> type === IPService :: IPRANGETYPE_BLACKLIST_AUTOMATIC ) { $ dt = $ range -...
Turn an IPRange instance into an array .
10,462
private function getHeaders ( ) { $ headers = [ t ( 'IP Range' ) , t ( 'Start address' ) , t ( 'End address' ) ] ; if ( $ this -> type === IPService :: IPRANGETYPE_BLACKLIST_AUTOMATIC ) { $ headers [ ] = t ( 'Expiration' ) ; } return $ headers ; }
Get the headers of the CSV .
10,463
public function showControls ( ) { if ( $ this -> showControls === true || $ this -> showControls === false ) { return $ this -> showControls ; } else { $ c = $ this -> getAreaCollectionObject ( ) ; return $ c -> isEditMode ( ) ; } }
Returns whether or not controls are to be displayed .
10,464
public function getTotalBlocksInArea ( $ c = false ) { if ( ! $ c ) { $ c = $ this -> c ; } $ this -> load ( $ c ) ; $ db = Database :: connection ( ) ; $ r = $ db -> fetchColumn ( 'select count(b.bID) from CollectionVersionBlocks cvb inner join Blocks b on cvb.bID = b.bID inner join BlockTypes bt on b.btID = bt.btID w...
Returns the total number of blocks in an area .
10,465
public function getTotalBlocksInAreaEditMode ( ) { $ db = Database :: connection ( ) ; return ( int ) $ db -> fetchColumn ( 'select count(b.bID) from CollectionVersionBlocks cvb inner join Blocks b on cvb.bID = b.bID inner join BlockTypes bt on b.btID = bt.btID where cID = ? and cvID = ? and arHandle = ?' , array ( $ t...
Returns the amount of actual blocks in the area does not exclude core blocks or layouts does not recurse .
10,466
final public static function get ( $ c , $ arHandle ) { if ( ! is_object ( $ c ) ) { return false ; } $ identifier = sprintf ( '/page/area/%s' , $ c -> getCollectionID ( ) ) ; $ cache = \ Core :: make ( 'cache/request' ) ; $ item = $ cache -> getItem ( $ identifier ) ; if ( ! $ item -> isMiss ( ) ) { $ areas = $ item -...
Gets the Area object for the given page and area handle .
10,467
public function create ( $ c , $ arHandle ) { $ db = Database :: connection ( ) ; $ db -> Replace ( 'Areas' , array ( 'cID' => $ c -> getCollectionID ( ) , 'arHandle' => $ arHandle , 'arIsGlobal' => $ this -> isGlobalArea ( ) ? 1 : 0 ) , array ( 'arHandle' , 'cID' ) , true ) ; $ this -> refreshCache ( $ c ) ; $ area = ...
Creates an area in the database . I would like to make this static but PHP pre 5 . 3 sucks at this stuff .
10,468
public function getAreaBlocksArray ( $ c = false ) { if ( ! $ c ) { $ c = $ this -> c ; } if ( ! $ this -> arIsLoaded ) { $ this -> load ( $ c ) ; } return $ this -> areaBlocksArray ; }
Get all of the blocks within the current area for a given page .
10,469
public static function getHandleList ( ) { $ db = Database :: connection ( ) ; $ r = $ db -> executeQuery ( 'select distinct arHandle from Areas where arParentID = 0 and arIsGlobal = 0 order by arHandle asc' ) ; $ handles = array ( ) ; while ( $ row = $ r -> FetchRow ( ) ) { $ handles [ ] = $ row [ 'arHandle' ] ; } $ r...
Gets a list of all areas .
10,470
public function revertToPagePermissions ( ) { $ db = Database :: connection ( ) ; $ v = array ( $ this -> getAreaHandle ( ) , $ this -> getCollectionID ( ) ) ; $ db -> executeQuery ( 'delete from AreaPermissionAssignments where arHandle = ? and cID = ?' , $ v ) ; $ db -> executeQuery ( 'update Areas set arOverrideColle...
This function removes all permissions records for the current Area and sets it to inherit from the Page permissions .
10,471
public function rescanAreaPermissionsChain ( ) { $ db = Database :: connection ( ) ; if ( $ this -> overrideCollectionPermissions ( ) ) { return false ; } $ areac = $ this -> getAreaCollectionObject ( ) ; if ( is_a ( $ areac , 'Page' ) ) { if ( $ areac -> getCollectionInheritance ( ) == 'PARENT' ) { $ cIDToCheck = $ ar...
Rescans the current Area s permissions ensuring that it s inheriting permissions properly up the chain .
10,472
public function rescanSubAreaPermissionsMasterCollection ( $ masterCollection ) { if ( ! $ masterCollection -> isMasterCollection ( ) ) { return false ; } $ toSetCID = ( $ this -> overrideCollectionPermissions ( ) ) ? $ masterCollection -> getCollectionID ( ) : 0 ; $ db = Database :: connection ( ) ; $ v = array ( $ th...
similar to rescanSubAreaPermissions but for those who have setup their pages to inherit master collection permissions .
10,473
public function export ( $ p , $ page ) { $ area = $ p -> addChild ( 'area' ) ; $ area -> addAttribute ( 'name' , $ this -> getAreaHandle ( ) ) ; $ blocks = $ page -> getBlocks ( $ this -> getAreaHandle ( ) ) ; $ c = $ this -> getAreaCollectionObject ( ) ; $ style = $ c -> getAreaCustomStyle ( $ this ) ; if ( is_object...
Exports the area to content format .
10,474
public function isRequired ( ) { $ result = $ this -> required ; if ( is_callable ( $ result ) ) { $ result = $ result ( $ this ) ; } return ( bool ) $ result ; }
Is this option required?
10,475
public function enableLegacyNamespace ( ) { $ this -> enableLegacyNamespace = true ; $ this -> disable ( ) ; $ this -> activateAutoloaders ( ) ; $ this -> enable ( ) ; }
Set legacy namespaces to enabled . This method unsets and resets this loader .
10,476
public function disableLegacyNamespace ( ) { $ this -> enableLegacyNamespace = false ; $ this -> disable ( ) ; $ this -> activateAutoloaders ( ) ; $ this -> enable ( ) ; }
Set legacy namespaces to disabled . This method unsets and resets this loader .
10,477
public function getCss ( ) { $ parser = new \ Less_Parser ( array ( 'cache_dir' => Config :: get ( 'concrete.cache.directory' ) , 'compress' => ( bool ) Config :: get ( 'concrete.theme.compress_preprocessor_output' ) , 'sourceMap' => ! Config :: get ( 'concrete.theme.compress_preprocessor_output' ) && ( bool ) Config :...
Compiles the stylesheet using LESS . If a ValueList is provided they are injected into the stylesheet .
10,478
public function getGroupedTimezones ( ) { $ groups = [ ] ; $ generics = [ ] ; $ genericGroupName = tc ( 'GenericTimezonesGroupName' , 'Others' ) ; foreach ( $ this -> getTimezones ( ) as $ id => $ fullName ) { $ chunks = explode ( '/' , $ fullName , 2 ) ; if ( ! isset ( $ chunks [ 1 ] ) ) { array_unshift ( $ chunks , $...
Returns the list of timezones with translated names grouped by region .
10,479
public function getTimezoneDisplayName ( $ timezone ) { $ displayName = '' ; if ( is_object ( $ timezone ) ) { if ( $ timezone instanceof \ DateTimeZone ) { $ displayName = $ timezone -> getName ( ) ; } elseif ( $ timezone instanceof \ DateTime ) { $ displayName = $ timezone -> getTimezone ( ) -> getName ( ) ; } } else...
Returns the display name of a timezone .
10,480
public function describeInterval ( $ diff , $ precise = false ) { $ secondsPerMinute = 60 ; $ secondsPerHour = 60 * $ secondsPerMinute ; $ secondsPerDay = 24 * $ secondsPerHour ; $ days = floor ( $ diff / $ secondsPerDay ) ; $ diff = $ diff - $ days * $ secondsPerDay ; $ hours = floor ( $ diff / $ secondsPerHour ) ; $ ...
Returns the localized representation of a time interval specified as seconds .
10,481
public function getTimezoneID ( $ timezone ) { $ app = Facade :: getFacadeApplication ( ) ; $ config = $ app -> make ( 'config' ) ; switch ( $ timezone ) { case 'system' : $ timezone = $ config -> get ( 'app.server_timezone' , @ date_default_timezone_get ( ) ? : 'UTC' ) ; break ; case 'app' : $ site = $ app -> make ( '...
Returns the normalized timezone identifier .
10,482
public function getTimezone ( $ timezone ) { $ tz = null ; $ phpTimezone = $ this -> getTimezoneID ( $ timezone ) ; if ( is_string ( $ phpTimezone ) && strlen ( $ phpTimezone ) ) { try { $ tz = new \ DateTimeZone ( $ phpTimezone ) ; } catch ( \ Exception $ x ) { } } return $ tz ; }
Returns a \ DateTimeZone instance for a specified timezone identifier .
10,483
public function toDateTime ( $ value = 'now' , $ toTimezone = 'system' , $ fromTimezone = 'system' ) { return Calendar :: toDateTime ( $ value , $ this -> getTimezone ( $ toTimezone ) , $ this -> getTimezone ( $ fromTimezone ) ) ; }
Convert a date to a \ DateTime instance .
10,484
public function getDeltaDays ( $ from , $ to , $ timezone = 'user' ) { $ dtFrom = $ this -> toDateTime ( $ from , $ timezone ) ; $ dtTo = $ this -> toDateTime ( $ to , $ timezone ) ; if ( is_null ( $ dtFrom ) || is_null ( $ dtTo ) ) { return null ; } $ dtFrom = $ this -> toDateTime ( $ dtFrom -> format ( 'Y-m-d' ) , $ ...
Returns the difference in days between to dates .
10,485
public function getPHPTimePattern ( ) { $ isoFormat = Calendar :: getTimeFormat ( 'short' ) ; $ result = Calendar :: tryConvertIsoToPhpFormat ( $ isoFormat ) ; if ( $ result === null ) { $ result = t ( 'g.i A' ) ; } return $ result ; }
Get the PHP date format string for times .
10,486
public function apply ( $ characterSet , $ collation , $ connectionName = '' , $ environment = '' , callable $ messageCallback = null , ErrorList $ warnings = null ) { if ( $ messageCallback === null ) { $ messageCallback = function ( $ message ) { } ; } if ( ( string ) $ connectionName === '' ) { $ connectionName = $ ...
Apply the character set and collation to a connection .
10,487
public function generateDefaultOccurrences ( CalendarEventVersion $ version ) { $ repetitions = $ version -> getRepetitionEntityCollection ( ) ; $ query = $ this -> entityManager -> createQuery ( 'delete from calendar:CalendarEventVersionOccurrence o where o.version = :version' ) ; $ query -> setParameter ( 'version' ,...
Handles generating occurrences with the default start and end times
10,488
public function requireOccurrenceRegeneration ( $ repetitions1 , $ repetitions2 ) { if ( count ( $ repetitions1 ) != count ( $ repetitions2 ) ) { return true ; } $ comparator = new Comparator ( ) ; for ( $ i = 0 ; $ i < count ( $ repetitions1 ) ; $ i ++ ) { if ( ! $ comparator -> areEqual ( $ repetitions1 [ $ i ] -> ge...
Returns true if the difference between the event versions impacts repetitions and occurrences .
10,489
protected function loadConfig ( $ level ) { $ app = Application :: getFacadeApplication ( ) ; $ drivers = [ ] ; $ driverConfigs = $ app [ 'config' ] -> get ( "concrete.cache.levels.{$level}.drivers" , [ ] ) ; $ preferredDriverName = $ app [ 'config' ] -> get ( "concrete.cache.levels.{$level}.preferred_driver" , null ) ...
Loads the composite driver from constants .
10,490
private function buildDriver ( array $ driverConfig ) { $ class = array_get ( $ driverConfig , 'class' , '' ) ; if ( $ class && class_exists ( $ class ) ) { $ implements = class_implements ( $ class ) ; if ( isset ( $ implements [ 'Stash\Interfaces\DriverInterface' ] ) ) { if ( $ class :: isAvailable ( ) ) { $ tempDriv...
Function used to build a driver from a driverConfig array .
10,491
public function exists ( $ key ) { if ( $ this -> enabled ) { return ! $ this -> pool -> getItem ( $ key ) -> isMiss ( ) ; } else { return false ; } }
Checks if an item exists in the cache .
10,492
public function enable ( ) { if ( $ this -> driver !== null ) { $ this -> pool -> setDriver ( $ this -> driver ) ; } $ this -> enabled = true ; }
Enables the cache .
10,493
public function disable ( ) { if ( ! ( $ this -> pool -> getDriver ( ) instanceof BlackHole ) ) { $ this -> driver = $ this -> pool -> getDriver ( ) ; } $ this -> pool -> setDriver ( new BlackHole ( ) ) ; $ this -> enabled = false ; }
Disables the cache .
10,494
public static function disableAll ( ) { $ app = Application :: getFacadeApplication ( ) ; $ app -> make ( 'cache/request' ) -> disable ( ) ; $ app -> make ( 'cache/expensive' ) -> disable ( ) ; $ app -> make ( 'cache' ) -> disable ( ) ; }
Disables all cache levels .
10,495
public static function enableAll ( ) { $ app = Application :: getFacadeApplication ( ) ; $ app -> make ( 'cache/request' ) -> enable ( ) ; $ app -> make ( 'cache/expensive' ) -> enable ( ) ; $ app -> make ( 'cache' ) -> enable ( ) ; }
Enables all cache levels .
10,496
protected function getExtraParams ( AccessTokenEntityInterface $ accessToken ) { $ params = parent :: getExtraParams ( $ accessToken ) ; if ( $ this -> isOidcRequest ( $ accessToken -> getScopes ( ) ) ) { $ user = $ this -> userInfoRepository -> getByID ( $ accessToken -> getUserIdentifier ( ) ) ; if ( $ user ) { $ par...
Get the extra params to include If this is an OIDC request we include the ID token
10,497
protected function createIdToken ( AccessTokenEntityInterface $ accessToken , ClaimsSet $ claims ) { $ issuer = $ this -> site -> getSite ( ) ; $ builder = ( new Builder ( ) ) -> setAudience ( $ accessToken -> getClient ( ) -> getIdentifier ( ) ) -> setIssuer ( $ issuer -> getSiteCanonicalURL ( ) ) -> setIssuedAt ( tim...
Create an ID token to include with our response
10,498
private function clientSupportsJson ( $ minWeight = null ) { try { $ app = Application :: getFacadeApplication ( ) ; $ rmrp = $ app -> make ( RequestMediaTypeParser :: class ) ; return $ rmrp -> isMediaTypeSupported ( 'application/json' , $ minWeight ) ; } catch ( Exception $ x ) { return null ; } catch ( Throwable $ x...
Check if the client supports JSON .
10,499
public static function getErrorMessage ( $ code ) { $ app = Application :: getFacadeApplication ( ) ; $ defaultStorage = $ app -> make ( StorageLocationFactory :: class ) -> fetchDefault ( ) -> getName ( ) ; $ msg = '' ; switch ( $ code ) { case self :: E_PHP_NO_FILE : case self :: E_FILE_INVALID : $ msg = t ( 'Invalid...
Returns a text string explaining the error that was passed .