idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
10,600 | public function getClass ( $ pkgHandle ) { $ cache = $ this -> application -> make ( 'cache/request' ) ; $ item = $ cache -> getItem ( 'package/class/' . $ pkgHandle ) ; $ cl = $ item -> get ( ) ; if ( $ item -> isMiss ( ) ) { $ item -> lock ( ) ; $ cl = \ Concrete \ Core \ Foundation \ ClassLoader :: getInstance ( ) ;... | Get the controller of a package given its handle . |
10,601 | public function getFileDisplayName ( ) { $ base = str_replace ( DIRECTORY_SEPARATOR , '/' , DIR_BASE ) ; if ( strpos ( $ this -> filename , $ base ) === 0 ) { $ path = substr ( $ this -> filename , strlen ( $ base ) + 1 ) ; } else { $ path = $ this -> filename ; } return str_replace ( '/' , DIRECTORY_SEPARATOR , $ path... | Get the display name of the translation file . |
10,602 | public static function create ( UserEntity $ userEntity , UserEntity $ actorEntity = null , DateTime $ dateCreated = null ) { return new self ( $ userEntity , $ actorEntity , $ dateCreated ) ; } | Factory method for creating new User event objects |
10,603 | public function mimeFromExtension ( $ ext ) { $ ext = strtolower ( $ ext ) ; if ( array_key_exists ( $ ext , self :: $ mime_types_and_extensions ) ) { return self :: $ mime_types_and_extensions [ $ ext ] ; } return false ; } | Converts a file extension into a mime type . |
10,604 | public function register ( ) { if ( ! $ this -> app -> bound ( TranslatorAdapterFactoryInterface :: class ) ) { $ this -> app -> bind ( TranslatorAdapterFactoryInterface :: class , function ( $ app , $ params ) { $ config = $ app -> make ( 'config' ) ; $ loaders = $ config -> get ( 'i18n.adapters.zend.loaders' , [ ] ) ... | Services that are essential for the loading of the localization functionality . |
10,605 | public function getEditorInitJSFunction ( $ dynamicOptions = [ ] ) { $ pluginManager = $ this -> getPluginManager ( ) ; if ( $ this -> allowFileManager ( ) ) { $ pluginManager -> select ( [ 'concrete5filemanager' , 'concrete5uploadimage' ] ) ; } else { $ pluginManager -> deselect ( [ 'concrete5filemanager' , 'concrete5... | Generate the Javascript code that initialize the plugin . |
10,606 | public function outputInlineEditorInitJSFunction ( ) { $ pluginManager = $ this -> getPluginManager ( ) ; if ( $ pluginManager -> isSelected ( 'autogrow' ) ) { $ pluginManager -> deselect ( 'autogrow' ) ; } return $ this -> getEditorInitJSFunction ( ) ; } | Generate the Javascript code that initialize the plugin when it will be used inline . |
10,607 | public function outputStandardEditorInitJSFunction ( ) { $ options = [ 'disableAutoInline' => true , ] ; $ pluginManager = $ this -> getPluginManager ( ) ; if ( $ pluginManager -> isSelected ( 'sourcearea' ) ) { $ pluginManager -> deselect ( 'sourcedialog' ) ; } return $ this -> getEditorInitJSFunction ( $ options ) ; ... | Generate the standard Javascript code that initialize the plugin . |
10,608 | protected function getLanguageOption ( ) { $ langPath = DIR_BASE_CORE . '/js/ckeditor4/vendor/lang/' ; $ useLanguage = 'en' ; $ language = strtolower ( str_replace ( '_' , '-' , Localization :: activeLocale ( ) ) ) ; if ( file_exists ( $ langPath . $ language . '.js' ) ) { $ useLanguage = $ language ; } elseif ( file_e... | Get the CKEditor language configuration . |
10,609 | private function getEditorSnippetsAndClasses ( ) { $ obj = new stdClass ( ) ; $ obj -> snippets = [ ] ; $ u = new User ( ) ; if ( $ u -> isRegistered ( ) ) { $ snippets = \ Concrete \ Core \ Editor \ Snippet :: getActiveList ( ) ; foreach ( $ snippets as $ sns ) { $ menu = new stdClass ( ) ; $ menu -> scsHandle = $ sns... | Build an object containing the CKEditor preconfigured snippets and classes . |
10,610 | protected function setOptions ( array $ options = [ ] ) { $ options += $ this -> getDefaultOptions ( ) ; $ this -> prefix = ! empty ( $ options [ 'prefix' ] ) ? $ options [ 'prefix' ] : null ; $ servers = [ ] ; foreach ( $ this -> getRedisServers ( array_get ( $ options , 'servers' , [ ] ) ) as $ server ) { $ servers [... | The options array should contain an array of servers . |
10,611 | protected function makeKeyString ( $ key , $ path = false ) { $ key = \ Stash \ Utilities :: normalizeKeys ( $ key ) ; $ keyString = 'cache:::' ; $ pathKey = ':pathdb::' ; foreach ( $ key as $ name ) { $ keyString .= $ name ; $ pathKey = ':pathdb::' . $ keyString ; $ pathKey = md5 ( $ pathKey ) ; if ( isset ( $ this ->... | Turns a key array into a key string . This includes running the indexing functions used to manage the Redis hierarchical storage . |
10,612 | public function get ( $ cfKey , $ pkgID = null ) { if ( $ pkgID > 0 && isset ( $ this -> rows [ "{$cfKey}.{$pkgID}" ] ) ) { return $ this -> rowToConfigValue ( $ this -> rows [ "{$cfKey}.{$pkgID}" ] ) ; } else { foreach ( $ this -> rows as $ row ) { if ( $ row [ 'cfKey' ] == $ cfKey ) { return $ this -> rowToConfigValu... | Get a config item . |
10,613 | public static function getByID ( $ cnvEditorID ) { $ db = Database :: connection ( ) ; $ r = $ db -> fetchAssoc ( 'select * from ConversationEditors where cnvEditorID = ?' , array ( $ cnvEditorID ) ) ; return static :: createFromRecord ( $ r ) ; } | Returns the appropriate conversation editor object for the given cnvEditorID . |
10,614 | public static function getByHandle ( $ cnvEditorHandle ) { $ db = Database :: connection ( ) ; $ r = $ db -> fetchAssoc ( 'select * from ConversationEditors where cnvEditorHandle = ?' , array ( $ cnvEditorHandle ) ) ; return static :: createFromRecord ( $ r ) ; } | Returns the appropriate conversation editor object for the given cnvEditorHandle . |
10,615 | protected static function createFromRecord ( $ record ) { if ( is_array ( $ record ) && $ record [ 'cnvEditorHandle' ] ) { $ textHelper = Core :: make ( 'helper/text' ) ; $ class = '\\Concrete\\Core\\Conversation\\Editor\\' . $ textHelper -> camelcase ( $ record [ 'cnvEditorHandle' ] ) . 'Editor' ; $ sc = Core :: make ... | This function is used to instantiate a Conversation Editor object from an associative array . |
10,616 | public function outputConversationEditorAddMessageForm ( ) { \ View :: element ( DIRNAME_CONVERSATIONS . '/' . DIRNAME_CONVERSATION_EDITOR . '/' . $ this -> cnvEditorHandle . '/message' , [ 'editor' => $ this ] , $ this -> getPackageHandle ( ) ) ; } | outputs an HTML block containing the add message form for the current Conversation Editor . |
10,617 | public function outputConversationEditorReplyMessageForm ( ) { \ View :: element ( DIRNAME_CONVERSATIONS . '/' . DIRNAME_CONVERSATION_EDITOR . '/' . $ this -> cnvEditorHandle . '/reply' , [ 'editor' => $ this ] , $ this -> getPackageHandle ( ) ) ; } | Outputs an HTML block containing the message reply form for the current Conversation Editor . |
10,618 | public function formatConversationMessageBody ( $ cnv , $ cnvMessageBody , $ config = array ( ) ) { $ htmlHelper = Core :: make ( 'helper/html' ) ; $ cnvMessageBody = $ htmlHelper -> noFollowHref ( $ cnvMessageBody ) ; if ( isset ( $ config [ 'htmlawed' ] ) ) { $ default = array ( 'safe' => 1 , 'elements' => 'p, br, st... | Returns a formatted conversation message body string based on configuration options supplied . |
10,619 | public static function add ( $ cnvEditorHandle , $ cnvEditorName , $ pkg = false ) { $ pkgID = 0 ; if ( is_object ( $ pkg ) ) { $ pkgID = $ pkg -> getPackageID ( ) ; } $ db = Database :: connection ( ) ; $ db -> insert ( 'ConversationEditors' , array ( 'cnvEditorHandle' => $ cnvEditorHandle , 'cnvEditorName' => $ cnvEd... | Creates a database record for the Conversation Editor then attempts to return the object . |
10,620 | public static function getList ( $ pkgID = null ) { $ db = Database :: connection ( ) ; $ queryBuilder = $ db -> createQueryBuilder ( ) -> select ( 'e.*' ) -> from ( 'ConversationEditors' , 'e' ) -> orderBy ( 'cnvEditorHandle' , 'asc' ) ; if ( $ pkgID !== null ) { $ queryBuilder -> andWhere ( 'e.pkgID = :pkgID' ) -> se... | Returns an array of all Editor Objects . |
10,621 | public function hasOptionsForm ( ) { $ env = Environment :: get ( ) ; $ rec = $ env -> getRecord ( DIRNAME_ELEMENTS . '/' . DIRNAME_CONVERSATIONS . '/' . DIRNAME_CONVERSATION_EDITOR . '/' . $ this -> cnvEditorHandle . '/' . FILENAME_CONVERSATION_EDITOR_OPTIONS , $ this -> getPackageHandle ( ) ) ; return $ rec -> exists... | Returns whether or not the current Conversation Editor has an options form . |
10,622 | public function getCustomEntityRepositories ( ) { $ result = [ ] ; $ app = ApplicationFacade :: getFacadeApplication ( ) ; $ pev = new PackageEntitiesEvent ( ) ; $ app -> make ( 'director' ) -> dispatch ( 'on_list_package_entities' , $ pev ) ; $ entityManagers = array_merge ( [ $ app -> make ( EntityManagerInterface ::... | Return the list of custom entity manager repositories . |
10,623 | protected function queueMessages ( ) { $ pages = $ users = $ files = $ sites = 0 ; foreach ( $ this -> pagesToQueue ( ) as $ id ) { yield "P{$id}" ; $ pages ++ ; } foreach ( $ this -> usersToQueue ( ) as $ id ) { yield "U{$id}" ; $ users ++ ; } foreach ( $ this -> filesToQueue ( ) as $ id ) { yield "F{$id}" ; $ files +... | Messages to add to the queue . |
10,624 | protected function clearIndex ( $ index ) { $ index -> clear ( Page :: class ) ; $ index -> clear ( User :: class ) ; $ index -> clear ( File :: class ) ; $ index -> clear ( Site :: class ) ; } | Clear out all indexes . |
10,625 | protected function pagesToQueue ( ) { $ qb = $ this -> connection -> createQueryBuilder ( ) ; $ query = $ qb -> select ( 'p.cID' ) -> from ( 'Pages' , 'p' ) -> leftJoin ( 'p' , 'CollectionSearchIndexAttributes' , 'a' , 'p.cID = a.cID' ) -> where ( 'cIsActive = 1' ) -> andWhere ( $ qb -> expr ( ) -> orX ( 'a.ak_exclude_... | Get Pages to add to the queue . |
10,626 | protected function usersToQueue ( ) { $ db = $ this -> connection ; $ query = $ db -> executeQuery ( 'SELECT uID FROM Users WHERE uIsActive = 1' ) ; while ( $ id = $ query -> fetchColumn ( ) ) { yield $ id ; } } | Get Users to add to the queue . |
10,627 | protected function filesToQueue ( ) { $ db = $ this -> connection ; $ query = $ db -> executeQuery ( 'SELECT fID FROM Files' ) ; while ( $ id = $ query -> fetchColumn ( ) ) { yield $ id ; } } | Get Files to add to the queue . |
10,628 | protected function sitesToQueue ( ) { $ db = $ this -> connection ; $ query = $ db -> executeQuery ( 'SELECT siteID FROM Sites' ) ; while ( $ id = $ query -> fetchColumn ( ) ) { yield $ id ; } } | Get Sites to add to the queue . |
10,629 | public static function translateFromEditMode ( $ text ) { $ app = Application :: getFacadeApplication ( ) ; $ entityManager = $ app -> make ( EntityManagerInterface :: class ) ; $ resolver = $ app -> make ( ResolverManagerInterface :: class ) ; $ appUrl = Application :: getApplicationURL ( ) ; $ text = preg_replace ( [... | Takes a chunk of content containing abstracted link references and expands them to urls suitable for the rich text editor . |
10,630 | protected static function replacePlaceholder ( $ text , $ pattern , callable $ resolver , $ caseSensitive = false ) { $ regex = "/{$pattern}/" ; if ( ! $ caseSensitive ) { $ regex .= 'i' ; } if ( ! preg_match_all ( $ regex , $ text , $ matches ) ) { return $ text ; } $ replaces = array_combine ( $ matches [ 0 ] , $ mat... | Replace a placeholder . |
10,631 | public static function getList ( ) { $ app = Application :: getFacadeApplication ( ) ; $ em = $ app -> make ( EntityManagerInterface :: class ) ; return $ em -> getRepository ( ThumbnailTypeEntity :: class ) -> findBy ( [ ] , [ 'ftTypeWidth' => 'asc' ] ) ; } | Get the list of all the available thumbnail types . |
10,632 | public static function getVersionList ( ) { $ app = Application :: getFacadeApplication ( ) ; $ config = $ app -> make ( 'config' ) ; $ createHightDPIVersions = ( bool ) $ config -> get ( 'concrete.file_manager.images.create_high_dpi_thumbnails' ) ; $ types = static :: getList ( ) ; $ versions = [ ] ; foreach ( $ types... | Get the list of all the available thumbnail type versions . |
10,633 | public static function exportList ( $ node ) { $ child = $ node -> addChild ( 'thumbnailtypes' ) ; $ list = static :: getList ( ) ; foreach ( $ list as $ link ) { $ linkNode = $ child -> addChild ( 'thumbnailtype' ) ; $ linkNode -> addAttribute ( 'name' , $ link -> getName ( ) ) ; $ linkNode -> addAttribute ( 'handle' ... | Export the list of all the thumbnail types . |
10,634 | public static function getByID ( $ id ) { if ( $ id ) { $ app = Application :: getFacadeApplication ( ) ; $ em = $ app -> make ( EntityManagerInterface :: class ) ; $ result = $ em -> find ( ThumbnailTypeEntity :: class , $ id ) ; } else { $ result = null ; } return $ result ; } | Get a thumbnail type given its id . |
10,635 | public static function getByHandle ( $ ftTypeHandle ) { $ ftTypeHandle = ( string ) $ ftTypeHandle ; $ app = Application :: getFacadeApplication ( ) ; $ cache = $ app -> make ( 'cache/request' ) ; $ item = $ cache -> getItem ( 'file/image/thumbnail/' . $ ftTypeHandle ) ; if ( $ item -> isMiss ( ) ) { $ em = $ app -> ma... | Get a thumbnail type given its handle . |
10,636 | public static function isOverLimit ( $ uID ) { if ( Config :: get ( 'concrete.user.private_messages.throttle_max' ) == 0 ) { return false ; } if ( Config :: get ( 'concrete.user.private_messages.throttle_max_timespan' ) == 0 ) { return false ; } $ db = Loader :: db ( ) ; $ dt = new DateTime ( ) ; $ dt -> modify ( '-' .... | checks to see if a user has exceeded their limit for sending private messages . |
10,637 | public static function getCoreChannels ( ) { return [ self :: CHANNEL_EMAIL , self :: CHANNEL_EXCEPTIONS , self :: CHANNEL_PACKAGES , self :: CHANNEL_SECURITY , self :: CHANNEL_AUTHENTICATION , self :: CHANNEL_PERMISSIONS , self :: CHANNEL_SPAM , self :: CHANNEL_SITE_ORGANIZATION , self :: CHANNEL_NETWORK , self :: CHA... | Get the list of the core channel . |
10,638 | public static function getChannels ( ) { $ app = Facade :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ channels = ( array ) $ db -> GetCol ( 'select distinct channel from Logs order by channel asc' ) ; return $ channels ; } | Get the list of channels that have been used . Requires the database handler . |
10,639 | public static function getChannelDisplayName ( $ channel ) { $ text = new Text ( ) ; switch ( $ channel ) { case self :: CHANNEL_APPLICATION : return tc ( 'Log channel' , 'Application' ) ; case self :: CHANNEL_AUTHENTICATION : return tc ( 'Log channel' , 'Authentication' ) ; case self :: CHANNEL_EMAIL : return tc ( 'Lo... | Get the display name of a channel . |
10,640 | protected static function removeExpired ( $ type ) { switch ( $ type ) { case UVTYPE_CHANGE_PASSWORD : $ lifetime = USER_CHANGE_PASSWORD_URL_LIFETIME ; break ; case UVTYPE_LOGIN_FOREVER : $ lifetime = USER_FOREVER_COOKIE_LIFETIME ; break ; default : $ lifetime = 5184000 ; break ; } $ db = Database :: connection ( ) ; $... | Removes old entries for the supplied type . |
10,641 | public static function add ( $ uID , $ type , $ singeHashAllowed = false , $ hashLength = 64 ) { self :: removeExpired ( $ type ) ; $ hash = self :: generate ( $ hashLength ) ; $ db = Database :: connection ( ) ; if ( $ singeHashAllowed ) { $ db -> executeQuery ( "DELETE FROM UserValidationHashes WHERE uID = ? AND type... | Adds a hash to the lookup table for a user and type removes any other existing hashes for the same user and type . |
10,642 | public static function getUserID ( $ hash , $ type ) { self :: removeExpired ( $ type ) ; $ db = Database :: connection ( ) ; $ uID = $ db -> fetchColumn ( "SELECT uID FROM UserValidationHashes WHERE uHash = ? AND type = ?" , array ( $ hash , $ type ) ) ; if ( is_numeric ( $ uID ) && $ uID > 0 ) { return $ uID ; } else... | Gets the users id for a given hash and type . |
10,643 | public static function getType ( $ hash ) { $ db = Database :: connection ( ) ; $ type = $ db -> fetchColumn ( "SELECT type FROM UserValidationHashes WHERE uHash = ? " , array ( $ hash ) ) ; if ( is_numeric ( $ type ) && $ type > 0 ) { return $ type ; } else { return false ; } } | Gets the hash type for a given hash . |
10,644 | public static function isValid ( $ hash ) { $ type = self :: getType ( $ hash ) ; self :: removeExpired ( $ type ) ; return ( bool ) self :: getUserID ( $ hash , $ type ) ; } | Validate the given hash |
10,645 | public function addUploadedImage ( $ field , $ errorMsg = null , $ emptyIsOk = true ) { $ const = ( $ emptyIsOk ) ? self :: VALID_UPLOADED_IMAGE : self :: VALID_UPLOADED_IMAGE_REQUIRED ; $ this -> addRequired ( $ field , $ errorMsg , $ const ) ; } | Adds a test to a field to ensure that if set it is a valid uploaded image . |
10,646 | public function addUploadedFile ( $ field , $ errorMsg = null , $ emptyIsOk = true ) { $ const = ( $ emptyIsOk ) ? self :: VALID_UPLOADED_FILE : self :: VALID_UPLOADED_FILE_REQUIRED ; $ this -> addRequired ( $ field , $ errorMsg , $ const ) ; } | Adds a test to a field to ensure that if set it is a valid uploaded file . |
10,647 | public function addInteger ( $ field , $ errorMsg = null , $ emptyIsOk = true ) { $ const = ( $ emptyIsOk ) ? self :: VALID_INTEGER : self :: VALID_INTEGER_REQUIRED ; $ this -> addRequired ( $ field , $ errorMsg , $ const ) ; } | Adds a required field and tests that it is integer only . |
10,648 | public function addRequiredEmail ( $ field , $ errorMsg = null ) { $ this -> addRequired ( $ field , $ errorMsg , self :: VALID_EMAIL ) ; } | Adds a required email address to the suite of tests to be run . |
10,649 | public function requireAsset ( $ assetType , $ assetHandle = false ) { $ list = AssetList :: getInstance ( ) ; if ( $ assetType instanceof AssetInterface ) { $ this -> requiredAssetGroup -> addAsset ( $ assetType ) ; } elseif ( $ assetType && $ assetHandle ) { $ ap = new AssetPointer ( $ assetType , $ assetHandle ) ; $... | Add an asset to the assets required for this plugin . |
10,650 | public function login ( $ username , $ password ) { $ className = $ this -> userClass ; $ user = new $ className ( $ username , $ password ) ; if ( $ user -> isError ( ) ) { $ this -> handleUserError ( $ user -> getError ( ) ) ; } return $ user ; } | Attempt login given a username and a password |
10,651 | public function failLogin ( $ username , $ password ) { $ ipFailed = false ; $ userFailed = false ; $ this -> ipService -> logFailedLogin ( ) ; $ this -> loginAttemptService -> trackAttempt ( $ username , $ password ) ; if ( $ this -> ipService -> failedLoginsThresholdReached ( ) ) { $ this -> ipService -> addToBlackli... | Handle a failed login attempt |
10,652 | public function logLoginAttempt ( $ username , array $ errors = [ ] ) { if ( $ this -> app ) { $ entry = $ this -> app -> make ( LoginAttempt :: class , [ $ username , $ this -> request ? $ this -> request -> getPath ( ) : '' , $ this -> getGroups ( $ username ) , $ errors ] ) ; $ context = $ entry -> getContext ( ) ; ... | Add a log entry for this login attempt |
10,653 | private function getGroups ( $ username ) { if ( ! $ this -> entityManager ) { return [ ] ; } $ db = $ this -> entityManager -> getConnection ( ) ; $ queryBuilder = $ db -> createQueryBuilder ( ) ; $ rows = $ queryBuilder -> select ( 'g.gName' , 'u.uID' ) -> from ( $ db -> getDatabasePlatform ( ) -> quoteSingleIdentifi... | Aggregate a list of groups to report |
10,654 | protected function handleUserError ( $ errorNum ) { switch ( $ errorNum ) { case USER_INACTIVE : throw new NotActiveException ( t ( $ this -> config -> get ( 'concrete.user.deactivation.message' ) ) ) ; case USER_SESSION_EXPIRED : throw new SessionExpiredException ( t ( 'Your session has expired. Please sign in again.'... | Throw an exception based on the given error number |
10,655 | protected function normalizeStringList ( $ value ) { if ( is_string ( $ value ) ) { $ strings = preg_split ( '/\s+/' , $ value , - 1 , PREG_SPLIT_NO_EMPTY ) ; } elseif ( is_array ( $ value ) ) { $ strings = array_map ( 'trim' , array_map ( 'strval' , $ value ) ) ; } else { $ strings = [ ] ; } return array_values ( arra... | Takes an array keeps only strings makes them lowercase and returns the unique values . |
10,656 | public function format ( $ mask , callable $ matchHandler ) { try { return preg_replace_callback ( '/%(.*?)%/i' , function ( $ matches ) use ( $ matchHandler ) { return $ this -> getResult ( $ matches [ 1 ] , $ matchHandler ) ? : '' ; } , $ mask ) ; } catch ( \ Exception $ e ) { $ this -> logger -> debug ( 'Failed to f... | Format a mask using the standard format given a callable |
10,657 | public function post ( $ key , $ defaultValue = null ) { $ r = Request :: getInstance ( ) ; return $ r -> post ( $ key , $ defaultValue ) ; } | Returns the value of the item in the POST array . |
10,658 | public function setThemeByPath ( $ path , $ theme = null , $ wrapper = FILENAME_THEMES_VIEW ) { $ l = Router :: get ( ) ; $ l -> setThemeByRoute ( $ path , $ theme , $ wrapper ) ; } | Legacy Items . Deprecated |
10,659 | public function setConsentType ( $ consentType ) { if ( $ consentType !== self :: CONSENT_SIMPLE && $ consentType !== self :: CONSENT_NONE ) { throw new InvalidArgumentException ( 'Invalid consent type provided.' ) ; } $ this -> consentType = $ consentType ; } | Set the level of consent this client must receive from the authenticating user |
10,660 | public function selectUser ( $ fieldName , $ uID = false ) { $ v = View :: getRequestInstance ( ) ; $ v -> requireAsset ( 'core/users' ) ; $ request = $ this -> app -> make ( Request :: class ) ; if ( $ request -> request -> has ( $ fieldName ) ) { $ selectedUID = $ request -> request -> get ( $ fieldName ) ; } elseif ... | Build the HTML to be placed in a page to choose a user using a popup dialog . |
10,661 | public function quickSelect ( $ fieldName , $ uID = false , $ miscFields = [ ] ) { $ v = View :: getRequestInstance ( ) ; $ v -> requireAsset ( 'selectize' ) ; $ request = $ this -> app -> make ( Request :: class ) ; if ( $ request -> request -> has ( $ fieldName ) ) { $ selectedUID = $ request -> request -> get ( $ fi... | Build the HTML to be placed in a page to choose a user using a select with users pupulated dynamically with ajax requests . |
10,662 | public function selectMultipleUsers ( $ fieldName , $ users = [ ] ) { $ identifier = $ this -> app -> make ( Identifier :: class ) -> getString ( 32 ) ; $ i18n = [ 'username' => t ( 'Username' ) , 'emailAddress' => t ( 'Email Address' ) , 'chooseUser' => t ( 'Choose User' ) , 'noUsers' => t ( 'No users selected.' ) , ]... | Build the HTML to be placed in a page to choose multiple users using a popup dialog . |
10,663 | public function highlightedMarkup ( $ fulltext , $ highlight ) { if ( ! $ highlight ) { return $ fulltext ; } $ this -> hText = $ fulltext ; $ this -> hHighlight = $ highlight ; $ this -> hText = @ preg_replace ( '#' . preg_quote ( $ this -> hHighlight , '#' ) . '#ui' , '<span style="background-color:' . $ this -> hCol... | Highlight parts of a text . |
10,664 | public function view ( ) { $ this -> set ( 'title' , $ this -> title ) ; $ this -> set ( 'buttonText' , $ this -> buttonText ) ; $ this -> set ( 'baseSearchPath' , $ this -> baseSearchPath ) ; $ this -> set ( 'postTo_cID' , $ this -> postTo_cID ) ; if ( ( string ) $ this -> resultsURL !== '' ) { $ resultsPage = null ; ... | Default view method . |
10,665 | public static function getUsedExtensionList ( ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( 'database' ) -> connection ( ) ; $ stm = $ db -> executeQuery ( "select distinct fvExtension from FileVersions where fvIsApproved = 1 and fvExtension is not null and fvExtension <> ''" ) ; $ extens... | Get the list of all the file extensions used by approved file versions . |
10,666 | public static function getUsedTypeList ( ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( 'database' ) -> connection ( ) ; $ stm = $ db -> query ( 'select distinct fvType from FileVersions where fvIsApproved = 1 and fvType is not null and fvType <> 0' ) ; $ types = [ ] ; while ( $ row = $ st... | Get the list of all the file types used by approved file versions . |
10,667 | public function getThumbnail ( $ fullImageTag = true ) { $ app = Application :: getFacadeApplication ( ) ; $ config = $ app -> make ( 'config' ) ; $ type = ThumbnailType :: getByHandle ( $ config -> get ( 'concrete.icons.file_manager_listing.handle' ) ) ; if ( file_exists ( DIR_AL_ICONS . '/' . $ this -> getExtension (... | Returns a thumbnail for this type of file . |
10,668 | public static function getGenericTypeText ( $ type ) { switch ( $ type ) { case static :: T_IMAGE : return t ( 'Image' ) ; break ; case static :: T_VIDEO : return t ( 'Video' ) ; break ; case static :: T_TEXT : return t ( 'Text' ) ; break ; case static :: T_AUDIO : return t ( 'Audio' ) ; break ; case static :: T_DOCUME... | Get the name of a generic file type . |
10,669 | public function revokeRefreshToken ( $ tokenId ) { $ this -> getEntityManager ( ) -> transactional ( function ( EntityManagerInterface $ em ) use ( $ tokenId ) { $ token = $ this -> find ( $ tokenId ) ; if ( $ token ) { $ em -> remove ( $ token ) ; } } ) ; } | Revoke the refresh token . |
10,670 | private function updateSize ( Version $ fv , ImageInterface $ image ) { $ result = false ; try { $ size = $ image -> getSize ( ) ; } catch ( Exception $ x ) { $ size = null ; } catch ( Throwable $ x ) { $ size = null ; } if ( $ size !== null ) { $ attributeCategory = $ fv -> getObjectAttributeCategory ( ) ; $ atWidth =... | Update the width and height attributes of the file version starting from the image data . |
10,671 | public function logFailedLogin ( AddressInterface $ ip = null , $ ignoreConfig = false ) { if ( $ ignoreConfig || $ this -> config -> get ( 'concrete.security.ban.ip.enabled' ) ) { if ( $ ip === null ) { $ ip = $ this -> getRequestIPAddress ( ) ; } $ comparableIP = $ ip -> getComparableString ( ) ; $ this -> connection... | Add the current IP address to the list of IPs with failed login attempts . |
10,672 | public function failedLoginsThresholdReached ( AddressInterface $ ip = null , $ ignoreConfig = false ) { $ result = false ; if ( $ ignoreConfig || $ this -> config -> get ( 'concrete.security.ban.ip.enabled' ) ) { if ( $ ip === null ) { $ ip = $ this -> getRequestIPAddress ( ) ; } if ( ! $ this -> isWhitelisted ( $ ip ... | Check if the current IP address has reached the failed login attempts threshold . |
10,673 | public function addToBlacklistForThresholdReached ( AddressInterface $ ip = null , $ ignoreConfig = false ) { if ( $ ignoreConfig || $ this -> config -> get ( 'concrete.security.ban.ip.enabled' ) ) { if ( $ ip === null ) { $ ip = $ this -> getRequestIPAddress ( ) ; } $ banDurationMinutes = ( int ) $ this -> config -> g... | Add an IP address to the list of IPs banned for too many failed login attempts . |
10,674 | public function createRange ( RangeInterface $ range , $ type , DateTime $ expiration = null ) { $ dateTimeFormat = $ this -> connection -> getDatabasePlatform ( ) -> getDateTimeFormatString ( ) ; $ this -> connection -> executeQuery ( ' INSERT INTO LoginControlIpRanges (lcirIpFrom, lc... | Add persist an IP address range type . |
10,675 | public function getRanges ( $ type , $ includeExpired = false ) { $ sql = 'SELECT * FROM LoginControlIpRanges WHERE lcirType = ?' ; $ params = [ ( int ) $ type ] ; if ( ! $ includeExpired ) { $ sql .= ' AND (lcirExpires IS NULL OR lcirExpires > ' . $ this -> connection -> getDatabasePlatform ( ) -> getNowExpression ( )... | Get the list of currently available ranges . |
10,676 | public function getRangeByID ( $ id ) { $ result = null ; if ( $ id ) { $ rs = $ this -> connection -> executeQuery ( 'SELECT * FROM LoginControlIpRanges WHERE lcirID = ? LIMIT 1' , [ $ id ] ) ; $ row = $ rs -> fetch ( ) ; $ rs -> closeCursor ( ) ; if ( $ row !== false ) { $ result = IPRange :: createFromRow ( $ row , ... | Find already defined range given its record ID . |
10,677 | public function deleteRange ( $ range ) { if ( $ range instanceof IPRange ) { $ id = $ range -> getID ( ) ; } else { $ id = ( int ) $ range ; } if ( $ id ) { $ this -> connection -> executeQuery ( 'DELETE FROM LoginControlIpRanges WHERE lcirID = ? LIMIT 1' , [ $ id ] ) ; } } | Delete a range record . |
10,678 | public function deleteFailedLoginAttempts ( $ maxAge = null ) { $ sql = 'DELETE FROM FailedLoginAttempts' ; if ( $ maxAge ) { $ platform = $ this -> connection -> getDatabasePlatform ( ) ; $ sql .= ' WHERE flaTimestamp <= ' . $ platform -> getDateSubSecondsExpression ( $ platform -> getNowExpression ( ) , ( int ) $ max... | Delete the failed login attempts . |
10,679 | public function deleteAutomaticBlacklist ( $ onlyExpired = true ) { $ sql = 'DELETE FROM LoginControlIpRanges WHERE lcirType = ' . ( int ) static :: IPRANGETYPE_BLACKLIST_AUTOMATIC ; if ( $ onlyExpired ) { $ platform = $ this -> connection -> getDatabasePlatform ( ) ; $ sql .= ' AND lcirExpires <= ' . $ platform -> get... | Clear the IP addresses automatically blacklisted . |
10,680 | private function fixPlurals ( $ filename , TextDomain $ textDomain , Language $ localeInfo ) { $ expectedNumPlurals = count ( $ localeInfo -> categories ) ; $ pluralRule = $ textDomain -> getPluralRule ( false ) ; if ( $ pluralRule === null ) { $ pluralRule = Rule :: fromString ( "nplurals={$expectedNumPlurals}; plural... | Fix the plural rules of the translations loaded from a file . |
10,681 | public function getResultIDs ( ) { $ results = $ this -> executeGetResults ( ) ; $ ids = [ ] ; foreach ( $ results as $ result ) { $ ids [ ] = $ result [ 'uID' ] ; } return $ ids ; } | similar to get except it returns an array of userIDs much faster than getting a UserInfo object for each result if all you need is the user s id . |
10,682 | public function filterByIsActive ( $ isActive ) { $ this -> includeInactiveUsers ( ) ; $ this -> query -> andWhere ( 'u.uIsActive = :uIsActive' ) ; $ this -> query -> setParameter ( 'uIsActive' , $ isActive ) ; } | Explicitly filters by whether a user is active or not . Does this by setting include inactive users to true THEN filtering them in our out . Some settings here are redundant given the default settings but a little duplication is ok sometimes . |
10,683 | public function filterByIsValidated ( $ isValidated ) { $ this -> includeInactiveUsers ( ) ; if ( ! $ isValidated ) { $ this -> includeUnvalidatedUsers ( ) ; $ this -> query -> andWhere ( 'u.uIsValidated = :uIsValidated' ) ; $ this -> query -> setParameter ( 'uIsValidated' , $ isValidated ) ; } } | Filter list by whether a user is validated or not . |
10,684 | public function filterByFuzzyUserName ( $ username ) { $ this -> query -> andWhere ( $ this -> query -> expr ( ) -> like ( 'u.uName' , ':uName' ) ) ; $ this -> query -> setParameter ( 'uName' , $ username . '%' ) ; } | Filter list by user name but as a like parameter . |
10,685 | private function checkGroupJoin ( ) { $ query = $ this -> getQueryObject ( ) ; $ params = $ query -> getQueryPart ( 'join' ) ; $ isGroupSet = false ; $ isUserGroupSet = false ; foreach ( $ params as $ param ) { foreach ( $ param as $ setTable ) if ( in_array ( 'ug' , $ setTable ) ) { $ isUserGroupSet = true ; } if ( in... | Function used to check if a group join has already been set |
10,686 | public function filterByInAnyGroup ( $ groups , $ inGroups = true ) { $ this -> checkGroupJoin ( ) ; $ groupIDs = [ ] ; $ orX = $ this -> getQueryObject ( ) -> expr ( ) -> orX ( ) ; $ app = Application :: getFacadeApplication ( ) ; $ likeBuilder = $ app -> make ( LikeBuilder :: class ) ; $ query = $ this -> getQueryObj... | Filters the user list for only users within at least one of the provided groups . |
10,687 | protected function loadPictureSettingsFromTheme ( ) { $ c = Page :: getCurrentPage ( ) ; if ( is_object ( $ c ) ) { $ pt = $ c -> getPageController ( ) -> getTheme ( ) ; if ( is_object ( $ pt ) ) { $ pt = $ pt -> getThemeHandle ( ) ; } $ th = Theme :: getByHandle ( $ pt ) ; if ( is_object ( $ th ) ) { $ this -> theme =... | Load picture settings from the theme . |
10,688 | public function clear ( ) { $ pageCategory = $ this -> app [ PageCategory :: class ] ; foreach ( $ pageCategory -> getList ( ) as $ key ) { $ indexer = $ key -> getSearchIndexer ( ) ; $ indexer -> updateSearchIndexKeyColumns ( $ pageCategory , $ key ) ; } $ database = $ this -> app [ 'database' ] -> connection ( ) ; $ ... | Clear out all indexed items |
10,689 | public function getJobQueueBatchSize ( ) { if ( $ this -> jQueueBatchSize === null ) { $ this -> jQueueBatchSize = Config :: get ( 'concrete.limits.job_queue_batch' ) ; } return $ this -> jQueueBatchSize ; } | Get the size of the queue batches |
10,690 | public function getQueueObject ( ) { if ( $ this -> jQueueObject === null ) { $ this -> jQueueObject = Queue :: get ( 'job_' . $ this -> getJobHandle ( ) , array ( 'timeout' => 1 ) ) ; } return $ this -> jQueueObject ; } | Get the queue object we re going to use to queue |
10,691 | public function markCompleted ( $ code = 0 , $ message = false ) { $ obj = parent :: markCompleted ( $ code , $ message ) ; $ queue = $ this -> getQueueObject ( ) ; if ( ! $ this -> didFail ( ) ) { $ queue -> deleteQueue ( ) ; } return $ obj ; } | Mark the queue as having completed |
10,692 | public function executeJob ( ) { if ( $ this -> getJobStatus ( ) !== 'RUNNING' ) { $ queue = $ this -> markStarted ( ) ; $ this -> start ( $ queue ) ; } else { $ queue = $ this -> getQueueObject ( ) ; } try { $ batchSize = $ this -> getJobQueueBatchSize ( ) ? : PHP_INT_MAX ; while ( ( $ messages = $ queue -> receive ( ... | Executejob for queueable jobs actually starts the queue runs and ends all in one function . This happens if we run a job in legacy mode . |
10,693 | public function executeBatch ( $ batch , ZendQueue $ queue ) { foreach ( $ batch as $ item ) { $ this -> processQueueItem ( $ item ) ; $ queue -> deleteMessage ( $ item ) ; } } | Process a queue batch |
10,694 | public static function getActive ( ) { $ app = Facade :: getFacadeApplication ( ) ; $ db = $ app -> make ( 'database' ) -> connection ( ) ; $ sclHandle = $ db -> fetchColumn ( 'select sclHandle from SystemCaptchaLibraries where sclIsActive = 1' ) ; return ( $ sclHandle === false ) ? null : static :: getByHandle ( $ scl... | Get the active library . |
10,695 | public static function getByHandle ( $ sclHandle ) { $ app = Facade :: getFacadeApplication ( ) ; $ db = $ app -> make ( 'database' ) -> connection ( ) ; $ r = $ db -> fetchAssoc ( 'select sclHandle, sclIsActive, pkgID, sclName from SystemCaptchaLibraries where sclHandle = ?' , [ $ sclHandle ] ) ; if ( $ r !== false ) ... | Get a library given its handle . |
10,696 | public static function add ( $ sclHandle , $ sclName , $ pkg = false ) { if ( is_object ( $ pkg ) ) { $ pkgID = $ pkg -> getPackageID ( ) ; } else { $ pkgID = ( int ) $ pkg ; } $ app = Facade :: getFacadeApplication ( ) ; $ db = $ app -> make ( 'database' ) -> connection ( ) ; $ db -> executeQuery ( 'insert into System... | Add a new library . |
10,697 | public function activate ( ) { $ app = Facade :: getFacadeApplication ( ) ; $ db = $ app -> make ( 'database' ) -> connection ( ) ; $ db -> executeQuery ( 'update SystemCaptchaLibraries set sclIsActive = 0' ) ; $ db -> executeQuery ( 'update SystemCaptchaLibraries set sclIsActive = 1 where sclHandle = ?' , [ $ this -> ... | Make this library the active one . |
10,698 | public static function getList ( ) { $ app = Facade :: getFacadeApplication ( ) ; $ db = $ app -> make ( 'database' ) -> connection ( ) ; $ libraries = [ ] ; foreach ( $ db -> fetchAll ( 'select sclHandle from SystemCaptchaLibraries order by sclHandle asc' ) as $ row ) { $ scl = static :: getByHandle ( $ row [ 'sclHand... | Retrieve all the installed libraries . |
10,699 | public static function getListByPackage ( $ pkg ) { if ( is_object ( $ pkg ) ) { $ pkgID = $ pkg -> getPackageID ( ) ; } else { $ pkgID = ( int ) $ pkg ; } $ app = Facade :: getFacadeApplication ( ) ; $ db = $ app -> make ( 'database' ) -> connection ( ) ; $ libraries = [ ] ; foreach ( $ db -> fetchAll ( 'select sclHan... | Retrieve the libraries installed by a package . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.