idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
10,700
public function export ( \ SimpleXMLElement $ xml ) { $ type = $ xml -> addChild ( 'library' ) ; $ type -> addAttribute ( 'handle' , $ this -> getSystemCaptchaLibraryHandle ( ) ) ; $ type -> addAttribute ( 'name' , $ this -> getSystemCaptchaLibraryName ( ) ) ; $ type -> addAttribute ( 'package' , $ this -> getPackageHa...
Export the data of this library .
10,701
public static function exportList ( \ SimpleXMLElement $ xml ) { $ list = self :: getList ( ) ; $ nxml = $ xml -> addChild ( 'systemcaptcha' ) ; foreach ( $ list as $ sc ) { $ sc -> export ( $ nxml ) ; } }
Export the data of all the libraries .
10,702
public function hasOptionsForm ( ) { $ path = DIRNAME_SYSTEM . '/' . DIRNAME_SYSTEM_CAPTCHA . '/' . $ this -> sclHandle . '/' . FILENAME_FORM ; if ( file_exists ( DIR_FILES_ELEMENTS . '/' . $ path ) ) { return true ; } elseif ( $ this -> pkgID > 0 ) { $ pkgHandle = $ this -> getPackageHandle ( ) ; $ dp = DIR_PACKAGES ....
Does this library has an option form?
10,703
public function getEntryPoint ( ) { if ( $ this -> entryPoint === null ) { $ this -> setEntryPoint ( $ this -> config -> get ( 'concrete.i18n.community_translation.entry_point' , '' ) ) ; } return $ this -> entryPoint ; }
Get the API entry point .
10,704
public function getApiToken ( ) { if ( $ this -> apiToken === null ) { $ this -> apiToken = ( string ) $ this -> config -> get ( 'concrete.i18n.community_translation.api_token' , '' ) ; } return $ this -> apiToken ; }
Get the API token .
10,705
public function getProgressLimit ( ) { if ( $ this -> progressLimit === null ) { $ this -> setProgressLimit ( $ this -> config -> get ( 'concrete.i18n.community_translation.progress_limit' , 90 ) ) ; } return $ this -> progressLimit ; }
Get the default progress limit .
10,706
protected function fixOverlappingStartEndDates ( ) { $ rs = $ this -> connection -> executeQuery ( <<<'EOT'select cv1.cID, cv1.cvIDfrom CollectionVersions as cv1 inner join CollectionVersions as cv2 on cv1.cID = cv2.cID and cv1.cvID <> cv2.cvID and cv1.cvIsApproved = cv2.cvIsApprovedwhe...
Be sure that there are not approved collection versions with overlapping publish dates .
10,707
public function filterByAttribute ( $ handle , $ value , $ comparison = '=' ) { $ ak = call_user_func_array ( array ( $ this -> getAttributeKeyClassName ( ) , 'getByHandle' ) , array ( $ handle ) ) ; if ( ! is_object ( $ ak ) ) { throw new \ Exception ( t ( 'Unable to find attribute %s' , $ handle ) ) ; } $ ak -> getCo...
Filters by a attribute .
10,708
public function process ( Version $ version ) { $ resource = $ version -> getFileResource ( ) ; $ originalData = $ resource -> read ( ) ; $ sanitizedData = $ this -> sanitizer -> sanitizeData ( $ originalData , $ this -> sanitizerOptions ) ; if ( $ sanitizedData !== $ originalData ) { $ version -> updateContents ( $ sa...
Remove potentially harmful elements and attributes from the SVG image .
10,709
public function filterByParentID ( $ cParentID ) { $ db = Loader :: db ( ) ; if ( is_array ( $ cParentID ) ) { $ cth = '(' ; for ( $ i = 0 ; $ i < count ( $ cParentID ) ; ++ $ i ) { if ( $ i > 0 ) { $ cth .= ',' ; } $ cth .= $ db -> quote ( $ cParentID [ $ i ] ) ; } $ cth .= ')' ; $ this -> filter ( false , "(p1.cParen...
Sets the parent ID that we will grab pages from .
10,710
public function get ( $ itemsToGet = 0 , $ offset = 0 ) { $ pages = [ ] ; if ( $ this -> getQuery ( ) == '' ) { $ this -> setBaseQuery ( ) ; } $ this -> setItemsPerPage ( $ itemsToGet ) ; $ r = parent :: get ( $ itemsToGet , $ offset ) ; foreach ( $ r as $ row ) { $ nc = $ this -> loadPageID ( $ row [ 'cID' ] , 'ACTIVE...
Returns an array of page objects based on current settings .
10,711
protected function nullifyInvalidForeignKey ( $ table , $ field , $ linkedTable , $ linkedField ) { $ platform = $ this -> connection -> getDatabasePlatform ( ) ; $ sqlTable = $ platform -> quoteSingleIdentifier ( $ table ) ; $ sqlField = $ platform -> quoteSingleIdentifier ( $ field ) ; $ sqlLinkedTable = $ platform -...
Set to NULL the fields in a table that reference not existing values of another table .
10,712
public function setConsole ( SymfonyApplication $ console , OutputInterface $ output = null , InputInterface $ input = null ) { $ this -> traitConsole = $ console ; if ( $ output ) { $ this -> setOutput ( $ output ) ; } if ( $ input ) { $ this -> setInput ( $ input ) ; } return $ this ; }
Set the console object
10,713
public function cloneCollection ( Collection $ c , ClonerOptions $ options ) { $ cDate = $ this -> dateHelper -> getOverridableNow ( ) ; $ this -> connection -> insert ( 'Collections' , [ 'cDateAdded' => $ cDate , 'cDateModified' => $ cDate , 'cHandle' => $ c -> getCollectionHandle ( ) , ] ) ; $ cID = $ c -> getCollect...
Create a clone of a collection and all its versions contents and attributes .
10,714
public function cloneCollectionVersion ( Version $ cvSource , Collection $ cDestination , ClonerOptions $ options ) { $ cSourceID = $ cvSource -> getCollectionID ( ) ; $ cvSourceID = $ cvSource -> getVersionID ( ) ; $ cSource = Page :: getByID ( $ cSourceID , $ cvSourceID ) ; $ cDestinationID = $ cDestination -> getCol...
Create a copy of a collection version to another collection .
10,715
public function cloneBlock ( Block $ block , Collection $ destinationCollection ) { $ bID = $ block -> getBlockID ( ) ; $ aHandle = $ block -> getAreaHandle ( ) ; $ toID = $ destinationCollection -> getCollectionID ( ) ; $ toCVID = $ destinationCollection -> getVersionID ( ) ; $ already = $ this -> connection -> fetchC...
Create an alias of a block to another collection .
10,716
protected function getUniquePageName ( $ pageName , $ parentID ) { $ uniquePageName = $ pageName ; $ parentID = ( int ) $ parentID ; $ index = 1 ; for ( ; ; ) { $ pageWithSameName = $ this -> connection -> fetchColumn ( 'select Pages.cID from CollectionVersions inner join Pages on (CollectionVersions.cID = Pages.cID an...
Get the name of a page that s unique for the parent .
10,717
protected function getUniquePageHandle ( $ handle , $ parentID ) { $ uniqueHandle = $ handle ; $ parentID = ( int ) $ parentID ; $ index = 1 ; for ( ; ; ) { $ pageWithSameHandle = $ this -> connection -> fetchColumn ( 'select Pages.cID from CollectionVersions inner join Pages on (CollectionVersions.cID = Pages.cID and ...
Get the handle of a page that s unique for the parent .
10,718
public function canDoAnyOf ( array $ operations ) { foreach ( $ operations as $ operation ) { if ( $ this -> canDo ( $ operation ) ) { return true ; } } return false ; }
Check if at least one operation can be performed .
10,719
public function whyCantDo ( $ operation ) { if ( ! is_string ( $ operation ) ) { return 'Invalid $operation' ; } if ( ! isset ( $ this -> operationErrors [ $ operation ] ) ) { switch ( $ operation ) { case static :: OPERATION_MOVE : $ error = $ this -> whyCantMove ( ) ; break ; case static :: OPERATION_ALIAS : $ error ...
Get the reason why an operation can t be performed .
10,720
protected function whyCantMove ( ) { $ destinationPageChecker = new Checker ( $ this -> getDestinationPage ( ) ) ; $ destinationPageID = $ this -> getDestinationPage ( ) -> getCollectionID ( ) ; foreach ( $ this -> getOriginalPages ( ) as $ originalPage ) { if ( $ originalPage -> getCollectionParentID ( ) == $ destinat...
Get the reason why the move operation can t be performed .
10,721
protected function whyCantAlias ( ) { if ( $ this -> isSomeOriginalPageAnAlias ( ) ) { return t ( 'It\'s not possible to create aliases of aliases.' ) ; } $ destinationPageChecker = new Checker ( $ this -> getDestinationPage ( ) ) ; foreach ( $ this -> getOriginalPages ( ) as $ originalPage ) { $ originalPageChecker = ...
Get the reason why the alias operation can t be performed .
10,722
protected function whyCantCopyVersion ( ) { $ originalPage = $ this -> getSingleOriginalPage ( ) ; if ( $ originalPage === null ) { return t ( "It's possible to copy just one page version at a time." ) ; } if ( $ originalPage -> isExternalLink ( ) ) { return t ( "It's not possible to copy the page version of an externa...
Get the reason why the copy - version operation can t be performed .
10,723
public static function get ( ) { $ db = Database :: connection ( ) ; $ treeID = $ db -> fetchColumn ( 'select Trees.treeID from TreeTypes inner join Trees on TreeTypes.treeTypeID = Trees.treeTypeID where TreeTypes.treeTypeHandle = ?' , [ 'file_manager' ] ) ; return $ treeID ? Tree :: getByID ( $ treeID ) : null ; }
Get the FileManager instance .
10,724
public function getConversationUsersToEmail ( ) { $ db = Loader :: db ( ) ; $ ids = array ( ) ; if ( ! $ this -> getConversationNotificationOverridesEnabled ( ) > 0 ) { $ ids = $ db -> GetCol ( 'select uID from ConversationSubscriptions where cnvID = 0' ) ; } $ r = $ db -> Execute ( 'select uID, type from ConversationS...
Similar to the method below but excludes global subscribers who have opted out of conversations etc ... This method should be used any time we actually act on subscriptions send emails etc ...
10,725
public function getAllowedFileExtensions ( ) { $ pk = $ this -> category -> getPermissionKeyByHandle ( 'add_file' ) ; $ pk -> setPermissionObject ( $ this -> object ) ; $ r = $ pk -> getAllowedFileExtensions ( ) ; return $ r ; }
Returns all file extensions this user can add .
10,726
public static function create ( $ href = '#' , $ rel = null , $ type = null , $ media = null ) { return new static ( $ href , $ rel , $ type , $ media ) ; }
Static alias for constructor .
10,727
public function register ( ) { $ config = $ this -> app -> make ( "config" ) ; if ( $ this -> app -> isInstalled ( ) && $ config -> get ( 'concrete.api.enabled' ) ) { $ router = $ this -> app -> make ( Router :: class ) ; $ list = new ApiRouteList ( ) ; $ list -> loadRoutes ( $ router ) ; $ this -> registerAuthorizatio...
Register API related stuff
10,728
private function getKeyPair ( ) { $ config = $ this -> app -> make ( 'config/database' ) ; $ keyPair = $ config -> get ( 'api.keypair' ) ; if ( ! $ keyPair ) { $ rsa = $ this -> app -> make ( RSA :: class ) ; $ keyPair = $ rsa -> createKey ( 2048 ) ; foreach ( $ keyPair as & $ item ) { $ item = str_replace ( "\r\n" , "...
Generate new RSA keys if needed
10,729
private function getKey ( $ handle ) { if ( ! $ this -> keyPair ) { $ this -> keyPair = $ this -> getKeyPair ( ) ; } return isset ( $ this -> keyPair [ $ handle ] ) ? $ this -> keyPair [ $ handle ] : null ; }
Get a key by handle
10,730
public function process ( Request $ request , DelegateInterface $ frame ) { try { return $ frame -> next ( $ request ) ; } catch ( OAuthServerException $ e ) { return $ e -> generateHttpResponse ( new Response ( ) ) ; } }
Process the request and return a PSR7 error response if needed
10,731
public function addAttachmentWithHeaders ( File $ file , array $ headers ) { $ fileVersion = $ file -> getVersion ( ) ; $ resource = $ fileVersion -> getFileResource ( ) ; if ( array_key_exists ( 'filename' , $ headers ) ) { $ filename = $ headers [ 'filename' ] ; unset ( $ headers [ 'filename' ] ) ; } else { $ filenam...
Add a File entity as an attachment of the message specifying the headers of the mail MIME part .
10,732
public function addRawAttachmentWithHeaders ( $ content , $ filename , array $ headers = [ ] ) { $ headers += [ 'mimetype' => 'application/octet-stream' , 'disposition' => Mime :: DISPOSITION_ATTACHMENT , 'encoding' => Mime :: ENCODING_BASE64 , 'charset' => '' , 'boundary' => '' , 'id' => '' , 'description' => '' , 'lo...
Add a mail attachment by specifying its raw binary data specifying the headers of the mail MIME part .
10,733
public function to ( $ email , $ name = null ) { if ( strpos ( $ email , ',' ) > 0 ) { $ email = explode ( ',' , $ email ) ; foreach ( $ email as $ em ) { $ this -> to [ ] = [ $ em , $ name ] ; } } else { $ this -> to [ ] = [ $ email , $ name ] ; } }
Add one or more To recipients to the message .
10,734
protected function generateEmailStrings ( $ arr ) { $ str = '' ; for ( $ i = 0 ; $ i < count ( $ arr ) ; ++ $ i ) { $ v = $ arr [ $ i ] ; if ( isset ( $ v [ 1 ] ) ) { $ str .= '"' . $ v [ 1 ] . '" <' . $ v [ 0 ] . '>' ; } elseif ( isset ( $ v [ 0 ] ) ) { $ str .= $ v [ 0 ] ; } if ( ( $ i + 1 ) < count ( $ arr ) ) { $ s...
Convert a list of email addresses to a string .
10,735
protected function isInlineAttachment ( MimePart $ attachment ) { return $ this -> bodyHTML !== false && $ attachment -> getId ( ) && in_array ( ( string ) $ attachment -> getDisposition ( ) , [ '' , Mime :: DISPOSITION_INLINE ] , true ) ; }
Determine if an attachment should be used as an inline attachment associated to the HTML body .
10,736
private function hasBeenUsed ( $ string , $ id ) { $ repository = $ this -> entityManager -> getRepository ( UsedString :: class ) ; $ allUses = $ repository -> findBy ( [ 'subject' => $ id ] , [ 'id' => 'desc' ] , $ this -> maxReuse ) ; foreach ( $ allUses as $ use ) { if ( $ this -> matches ( $ string , $ use ) ) { r...
Check whether a string has been used against an id
10,737
public function trackReview ( Message $ message , Block $ block ) { $ average = $ this -> fetchConversationAverage ( $ message -> getConversationID ( ) ) ; $ this -> assignAverage ( $ block , $ average ) ; }
Track a review on a message
10,738
public function transformNode ( $ treeNodeType ) { $ class = self :: getClassByType ( $ treeNodeType ) ; $ node = new $ class ( ) ; $ node -> setPropertiesFromArray ( $ this ) ; return $ node ; }
Transforms a node to another node .
10,739
public function getTreeNodeParentArray ( ) { $ db = Database :: connection ( ) ; $ nodeArray = [ ] ; $ currentNodeParentID = $ this -> getTreeNodeParentID ( ) ; if ( $ currentNodeParentID > 0 ) { while ( is_numeric ( $ currentNodeParentID ) && $ currentNodeParentID > 0 && $ currentNodeParentID ) { $ row = $ db -> fetch...
Returns an array of all parents of this tree node .
10,740
public function selectChildrenNodesByID ( $ nodeID , $ loadMissingChildren = false ) { if ( $ this -> getTreeNodeID ( ) == $ nodeID ) { $ this -> treeNodeIsSelected = true ; } else { foreach ( $ this -> getChildNodes ( ) as $ childnode ) { if ( $ loadMissingChildren && ! $ childnode -> getChildNodesLoaded ( ) ) { $ chi...
Recursively searches for a children node and marks it as selected .
10,741
public function checkMove ( Node $ newParent ) { $ result = null ; if ( $ this -> getTreeNodeParentID ( ) != $ newParent -> getTreeNodeID ( ) ) { if ( $ this -> getTreeNodeID ( ) == $ newParent -> getTreeNodeID ( ) ) { $ result = new MoveException ( t ( "It's not possible to move a node under itself" ) ) ; } else { for...
Check if this node can be moved under another parent .
10,742
public function move ( Node $ newParent ) { $ error = $ this -> checkMove ( $ newParent ) ; if ( $ error !== null ) { throw $ error ; } if ( $ this -> getTreeNodeParentID ( ) != $ newParent -> getTreeNodeID ( ) ) { $ db = Database :: connection ( ) ; $ existingDisplayOrder = $ this -> treeNodeDisplayOrder ; $ treeNodeD...
Move this node under another node .
10,743
public function updateDateModified ( ) { $ dateModified = Core :: make ( 'date' ) -> toDB ( ) ; $ db = Database :: connection ( ) ; $ db -> update ( 'TreeNodes' , [ 'dateModified' => $ dateModified ] , [ 'treeNodeID' => $ this -> getTreeNodeID ( ) ] ) ; }
Update the Date Modified to the current time .
10,744
public static function add ( $ parent = false ) { $ db = Database :: connection ( ) ; $ treeNodeParentID = 0 ; $ treeID = 0 ; $ treeNodeDisplayOrder = 0 ; $ inheritPermissionsFromTreeNodeID = 0 ; if ( is_object ( $ parent ) ) { $ treeNodeParentID = $ parent -> getTreeNodeID ( ) ; $ treeID = $ parent -> getTreeID ( ) ; ...
Add a new node .
10,745
public function hasGroup ( $ key ) { list ( $ namespace , $ group ) = $ this -> parseKey ( $ key ) ; return $ this -> loader -> exists ( $ group , $ namespace ) ; }
Determine if a configuration group exists .
10,746
public function save ( $ key , $ value ) { list ( $ namespace , $ group , $ item ) = $ this -> parseKey ( $ key ) ; $ collection = $ this -> getCollection ( $ group , $ namespace ) ; unset ( $ this -> items [ $ collection ] ) ; if ( $ this -> saver -> save ( $ item , $ value , $ this -> environment , $ group , $ namesp...
Save a key .
10,747
public function withKey ( $ key , $ value , callable $ callable ) { $ initialValue = $ this -> get ( $ key ) ; try { $ this -> set ( $ key , $ value ) ; return $ callable ( ) ; } finally { $ this -> set ( $ key , $ initialValue ) ; } }
Execute a callable using a specific key value .
10,748
protected function applyLengthValidators ( ValidatorManagerInterface $ manager ) { $ minimum = $ this -> getMinimumRequirement ( ) ; $ maximum = $ this -> getMaximumRequirement ( ) ; $ this -> applyMinMaxStrings ( $ minimum , $ maximum ) ; if ( $ maximum ) { $ manager -> setValidator ( 'maximum_length' , $ maximum ) ; ...
Apply configured password length validators
10,749
protected function getMaximumRequirement ( ) { $ maximumLength = $ this -> config -> get ( 'concrete.user.password.maximum' ) ; return $ maximumLength ? $ this -> app -> make ( MaximumLengthValidator :: class , [ $ maximumLength ] ) : null ; }
Get maximum length validator
10,750
protected function getMinimumRequirement ( ) { $ minimumLength = $ this -> config -> get ( 'concrete.user.password.minimum' , 8 ) ; return $ minimumLength ? $ this -> app -> make ( MinimumLengthValidator :: class , [ $ minimumLength ] ) : null ; }
Get minimum length validator
10,751
protected function applyMinMaxStrings ( $ minimum , $ maximum ) { if ( $ minimum && $ maximum ) { $ errorString = t ( 'A password must be between %s and %s characters long.' , $ minimum -> getMinimumLength ( ) , $ maximum -> getMaximumLength ( ) ) ; $ requirement = t ( 'Must be between %s and %s characters long.' , $ m...
Apply translatable strings to minimum and maximum requirements
10,752
protected function applyStringRequirementValidators ( ValidatorManagerInterface $ manager ) { $ specialCharacters = ( int ) $ this -> config -> get ( 'concrete.user.password.required_special_characters' , 0 ) ; $ lowerCase = ( int ) $ this -> config -> get ( 'concrete.user.password.required_lower_case' , 0 ) ; $ upperC...
Apply validators that require specific substrings
10,753
protected function regexValidator ( $ regex , $ requirement ) { $ validator = $ this -> app -> make ( RegexValidator :: class , [ $ regex ] ) ; $ validator -> setRequirementString ( RegexValidator :: E_DOES_NOT_MATCH , $ requirement ) ; $ validator -> setErrorString ( RegexValidator :: E_DOES_NOT_MATCH , $ requirement ...
Create a regex validator
10,754
protected function wrappedRegexValidator ( $ regex , $ requirementString ) { $ regexValidator = $ this -> regexValidator ( $ regex , $ requirementString ) ; $ validator = $ this -> app -> make ( ClosureValidator :: class , [ function ( ClosureValidator $ validator , $ string , ArrayAccess $ error = null ) use ( $ regex...
Create a closure validator that wraps a regex validator and handles all errors If the given regex is invalid we will deny all passwords!
10,755
public function getPageHeaderMenuItems ( $ position = false ) { if ( $ position ) { $ tmpItems = array ( ) ; foreach ( $ this -> pageHeaderMenuItems as $ mi ) { if ( $ mi -> getPosition ( ) == $ position ) { $ tmpItems [ ] = $ mi ; } } return $ tmpItems ; } else { return $ this -> pageHeaderMenuItems ; } }
Returns current menu items .
10,756
protected function getReplacingFile ( ) { if ( $ this -> replacingFile === false ) { $ replacingFile = null ; $ fID = $ this -> request -> request -> get ( 'fID' , $ this -> request -> query -> get ( 'fID' ) ) ; if ( $ fID && is_scalar ( $ fID ) ) { $ fID = ( int ) $ fID ; if ( $ fID !== 0 ) { $ replacingFile = $ this ...
Get the file being replaced .
10,757
protected function setReplacingFile ( File $ value = null ) { if ( $ value !== $ this -> replacingFile ) { $ this -> replacingFile = $ value ; } return $ this ; }
Set the file being replaced .
10,758
public function process ( ) { $ queue = $ this -> getQueue ( ) ; $ tasks = $ this -> getTasks ( ) ; foreach ( $ this -> target -> getItems ( ) as $ targetItem ) { foreach ( $ tasks as $ task ) { $ action = new QueueAction ( $ this , $ this -> target , $ task [ 1 ] , $ targetItem ) ; $ queue -> send ( serialize ( $ acti...
Takes the current queue and fills it based on the currently registered tasks and the registered processor .
10,759
public function getConfigRepository ( ) { if ( ! $ this -> siteConfig ) { $ app = Application :: getFacadeApplication ( ) ; $ this -> updateSiteConfigRepository ( $ app -> make ( 'config' ) , $ this ) ; } return $ this -> siteConfig ; }
Get the site configuration repository .
10,760
public function getSiteHomePageObject ( $ version = 'RECENT' ) { $ tree = $ this -> getSiteTreeObject ( ) ; return $ tree === null ? null : $ tree -> getSiteHomePageObject ( $ version ) ; }
Get the home page of the default language .
10,761
public function getTimezone ( ) { $ timezone = null ; $ config = $ this -> getConfigRepository ( ) ; if ( $ config ) { $ timezone = $ config -> get ( 'timezone' ) ; } if ( ! $ timezone ) { $ timezone = date_default_timezone_get ( ) ; } return $ timezone ; }
Get the site time zone identifier .
10,762
public function reindex ( ) { $ category = \ Core :: make ( 'Concrete\Core\Attribute\Category\FileCategory' ) ; $ indexer = $ category -> getSearchIndexer ( ) ; $ values = $ category -> getAttributeValues ( $ this ) ; foreach ( $ values as $ value ) { $ indexer -> indexEntry ( $ category , $ value , $ this ) ; } }
Reindex the attributes on this file .
10,763
public function setFileStorageLocation ( \ Concrete \ Core \ Entity \ File \ StorageLocation \ StorageLocation $ newLocation ) { $ fh = Loader :: helper ( 'concrete/file' ) ; $ currentLocation = $ this -> getFileStorageLocationObject ( ) ; if ( $ newLocation -> getID ( ) == $ currentLocation -> getID ( ) ) { return fal...
Move a file from its current FSL to a new FSL .
10,764
public function setPassword ( $ pw ) { $ fe = new \ Concrete \ Core \ File \ Event \ FileWithPassword ( $ this ) ; $ fe -> setFilePassword ( $ pw ) ; Events :: dispatch ( 'on_file_set_password' , $ fe ) ; $ this -> fPassword = $ pw ; $ this -> save ( ) ; }
Sets the access password on a file .
10,765
public function setUser ( \ Concrete \ Core \ Entity \ User \ User $ user ) { $ this -> author = $ user ; $ this -> save ( ) ; }
Set the user who authored the file .
10,766
public function getFileSetIDs ( ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ rows = $ db -> fetchAll ( 'select fsID from FileSetFiles where fID = ?' , [ $ this -> getFileID ( ) ] ) ; $ ids = array_map ( 'intval' , array_map ( 'array_pop' , $ rows ) ) ; return $ ...
Get the IDs of the file sets that this file belongs to .
10,767
public function getFileSets ( ) { $ filesets = [ ] ; foreach ( $ this -> getFileSetIDs ( ) as $ fsID ) { $ fs = FileSet :: getByID ( $ fsID ) ; if ( $ fs !== null ) { $ filesets [ ] = $ fs ; } } return $ filesets ; }
Get the file sets that this file belongs to .
10,768
public function isStarred ( $ u = false ) { if ( ! $ u ) { $ u = new User ( ) ; } $ db = Loader :: db ( ) ; $ r = $ db -> GetOne ( 'select fsfID from FileSetFiles fsf inner join FileSets fs on fs.fsID = fsf.fsID where fsf.fID = ? and fs.uID = ? and fs.fsType = ?' , [ $ this -> getFileID ( ) , $ u -> getUserID ( ) , Fil...
Tell if a file is starred by a user .
10,769
public function createNewVersion ( $ copyUnderlyingFile = false ) { $ fv = $ this -> getRecentVersion ( ) ; $ fav = $ this -> getApprovedVersion ( ) ; $ fv2 = $ fv -> duplicate ( ) ; if ( $ fv -> getFileVersionID ( ) == $ fav -> getFileVersionID ( ) ) { $ fv2 -> approve ( ) ; } if ( $ copyUnderlyingFile ) { $ fv2 -> du...
Create a new version of a file .
10,770
public function getVersionToModify ( $ forceCreateNew = false ) { $ u = new User ( ) ; $ createNew = false ; $ fv = $ this -> getRecentVersion ( ) ; $ fav = $ this -> getApprovedVersion ( ) ; if ( $ u -> getUserID ( ) != $ fv -> getAuthorUserID ( ) ) { $ createNew = true ; } $ diff = time ( ) - $ fv -> getDateAdded ( )...
Returns a file version object that is to be written to . Computes whether we can use the current most recent version OR a new one should be created .
10,771
public function setFileFolder ( FileFolder $ folder ) { $ em = \ ORM :: entityManager ( 'core' ) ; $ this -> folderTreeNodeID = $ folder -> getTreeNodeID ( ) ; $ em -> persist ( $ this ) ; $ em -> flush ( ) ; }
Folder to put the file in .
10,772
public function inFileSet ( Set $ fs ) { $ db = Loader :: db ( ) ; $ r = $ db -> GetOne ( 'select fsfID from FileSetFiles where fID = ? and fsID = ?' , [ $ this -> getFileID ( ) , $ fs -> getFileSetID ( ) ] ) ; return $ r > 0 ; }
If a file is in a particular file set .
10,773
public function delete ( $ removeNode = true ) { $ db = Core :: make ( Connection :: class ) ; $ em = $ db -> getEntityManager ( ) ; $ em -> beginTransaction ( ) ; try { $ fve = new \ Concrete \ Core \ File \ Event \ DeleteFile ( $ this ) ; $ fve = Events :: dispatch ( 'on_file_delete' , $ fve ) ; if ( ! $ fve -> proce...
Removes a file including all of its versions .
10,774
public function getRecentVersion ( ) { $ em = \ ORM :: entityManager ( ) ; $ r = $ em -> getRepository ( '\Concrete\Core\Entity\File\Version' ) ; return $ r -> findOneBy ( [ 'file' => $ this ] , [ 'fvID' => 'desc' ] ) ; }
Returns the most recent FileVersion object .
10,775
public function getVersion ( $ fvID = null ) { if ( ! $ fvID ) { return $ this -> getApprovedVersion ( ) ; } $ em = \ ORM :: entityManager ( ) ; $ r = $ em -> getRepository ( '\Concrete\Core\Entity\File\Version' ) ; return $ r -> findOneBy ( [ 'file' => $ this , 'fvID' => $ fvID ] ) ; }
returns the FileVersion object for the provided fvID if none provided returns the approved version .
10,776
public function getDownloadStatistics ( $ limit = 20 ) { $ db = Loader :: db ( ) ; $ limitString = '' ; if ( $ limit != false ) { $ limitString = 'limit ' . intval ( $ limit ) ; } if ( is_object ( $ this ) && $ this instanceof self ) { return $ db -> getAll ( "SELECT * FROM DownloadStatistics WHERE fID = ? ORDER BY tim...
Get the download statistics for the current file .
10,777
public function trackDownload ( $ rcID = null ) { $ u = new User ( ) ; $ uID = intval ( $ u -> getUserID ( ) ) ; $ fv = $ this -> getApprovedVersion ( ) ; $ fvID = $ fv -> getFileVersionID ( ) ; if ( ! isset ( $ rcID ) || ! is_numeric ( $ rcID ) ) { $ rcID = 0 ; } $ fve = new \ Concrete \ Core \ File \ Event \ FileAcce...
Tracks File Download takes the cID of the page that the file was downloaded from .
10,778
public function delete ( ) { $ list = StorageLocation :: getList ( ) ; foreach ( $ list as $ item ) { if ( $ item -> getTypeObject ( ) -> getHandle ( ) == $ this -> getHandle ( ) ) { throw new \ Exception ( t ( 'Please remove all storage locations using this storage type.' ) ) ; } } $ em = \ ORM :: entityManager ( ) ; ...
Removes the storage type if no configurations exist .
10,779
public function getStyleValueList ( ) { if ( ! isset ( $ this -> styleValueList ) ) { $ this -> styleValueList = \ Concrete \ Core \ StyleCustomizer \ Style \ ValueList :: loadFromLessFile ( $ this -> file , $ this -> urlroot ) ; } return $ this -> styleValueList ; }
Gets the style value list object for this preset .
10,780
public static function getByID ( $ cID , $ version = 'RECENT' ) { $ db = Loader :: db ( ) ; $ q = 'select Collections.cDateAdded, Collections.cDateModified, Collections.cID from Collections where cID = ?' ; $ row = $ db -> getRow ( $ q , [ $ cID ] ) ; $ c = new self ( ) ; $ c -> setPropertiesFromArray ( $ row ) ; if ( ...
Get a collection by ID .
10,781
public static function createCollection ( $ data ) { $ db = Loader :: db ( ) ; $ dh = Loader :: helper ( 'date' ) ; $ cDate = $ dh -> getOverridableNow ( ) ; $ data = array_merge ( [ 'name' => '' , 'pTemplateID' => 0 , 'handle' => null , 'uID' => null , 'cDatePublic' => $ cDate , 'cDescription' => null , ] , $ data ) ;...
Create a new Collection instance .
10,782
public function getNextVersionComments ( ) { $ c = Page :: getByID ( $ this -> getCollectionID ( ) , 'ACTIVE' ) ; $ cvID = $ c -> getVersionID ( ) ; return t ( 'Version %d' , $ cvID + 1 ) ; }
Get the automatic comment for the next collection version .
10,783
public function clearCollectionAttributes ( $ retainAKIDs = [ ] ) { $ db = Loader :: db ( ) ; if ( count ( $ retainAKIDs ) > 0 ) { $ cleanAKIDs = [ ] ; foreach ( $ retainAKIDs as $ akID ) { $ cleanAKIDs [ ] = ( int ) $ akID ; } $ akIDStr = implode ( ',' , $ cleanAKIDs ) ; $ v2 = [ $ this -> getCollectionID ( ) , $ this...
Delete the values of the attributes associated to the currently loaded collection version .
10,784
public function getSetCollectionAttributes ( ) { $ category = $ this -> vObj -> getObjectAttributeCategory ( ) ; $ values = $ category -> getAttributeValues ( $ this -> vObj ) ; $ attribs = [ ] ; foreach ( $ values as $ value ) { $ attribs [ ] = $ value -> getAttributeKey ( ) ; } return $ attribs ; }
Get the list of attribute keys for which the currently loaded collection version has values .
10,785
public function hasAliasedContent ( ) { $ db = Loader :: db ( ) ; $ v = [ $ this -> cID ] ; $ q = 'select bID from CollectionVersionBlocks where cID = ? and isOriginal = 1' ; $ r = $ db -> query ( $ q , $ v ) ; $ bIDArray = [ ] ; if ( $ r ) { while ( $ row = $ r -> fetchRow ( ) ) { $ bIDArray [ ] = $ row [ 'bID' ] ; } ...
Does this collection contain blocks that are aliased in other pages?
10,786
public function getAreaCustomStyle ( $ area , $ force = false ) { $ areac = $ area -> getAreaCollectionObject ( ) ; if ( $ areac instanceof Stack ) { return null ; } $ result = null ; $ styles = $ this -> vObj -> getCustomAreaStyles ( ) ; $ areaHandle = $ area -> getAreaHandle ( ) ; if ( $ force || isset ( $ styles [ $...
Get the custom style of an area in the currently loaded collection version .
10,787
public function setCustomStyleSet ( $ area , $ set ) { $ db = Loader :: db ( ) ; $ db -> Replace ( 'CollectionVersionAreaStyles' , [ 'cID' => $ this -> getCollectionID ( ) , 'cvID' => $ this -> getVersionID ( ) , 'arHandle' => $ area -> getAreaHandle ( ) , 'issID' => $ set -> getID ( ) , ] , [ 'cID' , 'cvID' , 'arHandl...
Set the custom style of an area in the currently loaded collection version .
10,788
public function resetAreaCustomStyle ( $ area ) { $ db = Loader :: db ( ) ; $ db -> Execute ( 'delete from CollectionVersionAreaStyles where cID = ? and cvID = ? and arHandle = ?' , [ $ this -> getCollectionID ( ) , $ this -> getVersionID ( ) , $ area -> getAreaHandle ( ) , ] ) ; }
Delete all the custom styles of an area of the currently loaded collection version .
10,789
public function relateVersionEdits ( $ oc ) { $ db = Loader :: db ( ) ; $ v = [ $ this -> getCollectionID ( ) , $ this -> getVersionID ( ) , $ oc -> getCollectionID ( ) , $ oc -> getVersionID ( ) , ] ; $ r = $ db -> GetOne ( 'select count(*) from CollectionVersionRelatedEdits where cID = ? and cvID = ? and cRelationID ...
Associate the edits of another collection to this collection .
10,790
public function getGlobalBlocks ( ) { $ db = Loader :: db ( ) ; $ v = [ Stack :: ST_TYPE_GLOBAL_AREA ] ; $ rs = $ db -> GetCol ( 'select stName from Stacks where Stacks.stType = ?' , $ v ) ; $ blocks = [ ] ; if ( count ( $ rs ) > 0 ) { $ pcp = new Permissions ( $ this ) ; foreach ( $ rs as $ garHandle ) { if ( $ pcp ->...
Get the blocks contained in the all the global areas .
10,791
public function addBlock ( $ bt , $ a , $ data ) { $ db = Loader :: db ( ) ; $ nb = $ bt -> add ( $ data , $ this , $ a ) ; $ arHandle = ( is_object ( $ a ) ) ? $ a -> getAreaHandle ( ) : $ a ; $ cID = $ this -> getCollectionID ( ) ; $ vObj = $ this -> getVersionObject ( ) ; if ( $ bt -> includeAll ( ) ) { $ newBlockDi...
Add a new block to a specific area of the currently loaded collection version .
10,792
public function addFeature ( Feature $ fe ) { $ db = Loader :: db ( ) ; $ db -> Replace ( 'CollectionVersionFeatures' , [ 'cID' => $ this -> getCollectionID ( ) , 'cvID' => $ this -> getVersionID ( ) , 'feID' => $ fe -> getFeatureID ( ) ] , [ 'cID' , 'cvID' , 'feID' ] , true ) ; }
Associate a feature to the currently loaded collection version .
10,793
public function delete ( ) { if ( $ this -> cID > 0 ) { $ db = Loader :: db ( ) ; $ vl = new VersionList ( $ this ) ; $ vl -> setItemsPerPage ( - 1 ) ; $ vlArray = $ vl -> getPage ( ) ; foreach ( $ vlArray as $ v ) { $ v -> delete ( ) ; } $ cID = $ this -> getCollectionID ( ) ; $ q = "delete from CollectionAttributeVal...
Delete this collection and all its versions contents and attributes .
10,794
public function duplicateCollection ( ) { $ app = Application :: getFacadeApplication ( ) ; $ cloner = $ app -> make ( Cloner :: class ) ; $ clonerOptions = $ app -> build ( ClonerOptions :: class ) -> setKeepOriginalAuthor ( true ) ; $ newCollection = $ cloner -> cloneCollection ( $ this , $ clonerOptions ) ; return $...
Create a clone of this collection and all its versions contents and attributes .
10,795
public function cloneVersion ( $ versionComments , $ createEmpty = false ) { $ app = Application :: getFacadeApplication ( ) ; $ cloner = $ app -> make ( Cloner :: class ) ; $ clonerOptions = $ app -> make ( ClonerOptions :: class ) -> setVersionComments ( $ versionComments ) -> setCopyContents ( $ createEmpty ? false ...
Clone the currently loaded version and returns a Page instance containing the new version .
10,796
public function addEntityManager ( EntityManagerInterface $ em ) { if ( ! in_array ( $ em , $ this -> entityManagers , true ) ) { $ this -> entityManagers [ ] = $ em ; } return $ this ; }
Add an EntityManagerInterface instance to the list .
10,797
public function image ( $ pathToImage ) { if ( ! function_exists ( 'exif_imagetype' ) ) { function exif_imagetype ( $ filename ) { if ( ( list ( $ width , $ height , $ type , $ attr ) = getimagesize ( $ filename ) ) !== false ) { return $ type ; } return false ; } } $ val = @ exif_imagetype ( $ pathToImage ) ; return i...
Tests whether the passed item a valid image .
10,798
public function extension ( $ filename , $ extensions = null ) { $ f = Loader :: helper ( 'file' ) ; $ ext = strtolower ( $ f -> getExtension ( $ filename ) ) ; if ( isset ( $ extensions ) && is_array ( $ extensions ) && count ( $ extensions ) ) { $ allowed_extensions = $ extensions ; } else { $ extensions_string = str...
Parses the file extension for a given file name checks it to see if it s in the the extension array if provided if not it checks to see if it s in the concrete . upload . extensions configuration option .
10,799
public function addCookie ( $ name , $ value = null , $ expire = 0 , $ path = '/' , $ domain = null , $ secure = false , $ httpOnly = true ) { $ cookie = new Cookie ( $ name , $ value , $ expire , $ path , $ domain , $ secure , $ httpOnly ) ; $ this -> addCookieObject ( $ cookie ) ; return $ cookie ; }
Adds a Cookie object to the cookie pantry .