idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
9,800 | public function displayPaging ( $ script = false , $ return = false , $ additionalVars = array ( ) ) { $ summary = $ this -> getSummary ( ) ; $ paginator = $ this -> getPagination ( $ script , $ additionalVars ) ; if ( $ summary -> pages > 1 ) { $ html = '<div class="ccm-spacer"></div>' ; $ html .= '<div class="ccm-pag... | Gets standard HTML to display paging |
9,801 | public function getSummary ( ) { $ ss = new \ stdClass ( ) ; $ ss -> chunk = $ this -> itemsPerPage ; $ ss -> order = $ this -> sortByDirection ; $ ss -> startAt = $ this -> start ; $ ss -> total = $ this -> getTotal ( ) ; $ ss -> startAt = ( $ ss -> startAt < $ ss -> chunk ) ? '0' : $ ss -> startAt ; $ itc = intval ( ... | Returns an object with properties useful for paging . |
9,802 | protected function parseRuleOptions ( InputInterface $ input ) { $ ruleOptions = [ ] ; foreach ( $ input -> getArgument ( 'rule-options' ) as $ keyValuePair ) { list ( $ key , $ value ) = explode ( '=' , $ keyValuePair , 2 ) ; $ key = trim ( $ key ) ; if ( substr ( $ key , - 2 ) === '[]' ) { $ isArray = true ; $ key = ... | Parse the rule - options input argument . |
9,803 | public function forceMaxInitialMigration ( ) { $ forcedInitialMigration = null ; foreach ( array_reverse ( $ this -> getMigrations ( ) ) as $ migration ) { if ( $ migration -> isMigrated ( ) && ! $ migration -> getMigration ( ) instanceof RepeatableMigrationInterface ) { break ; } $ forcedInitialMigration = $ migration... | Force the initial migration to be the least recent repeatable one . |
9,804 | public function forceInitialMigration ( $ reference , $ criteria = self :: FORCEDMIGRATION_INCLUSIVE ) { $ reference = trim ( ( string ) $ reference ) ; if ( $ reference === '' ) { throw new Exception ( t ( 'Invalid initial migration reference.' ) ) ; } if ( ! in_array ( $ criteria , [ static :: FORCEDMIGRATION_INCLUSI... | Force the initial migration using a specific point . |
9,805 | public function registerPreviousMigratedVersions ( ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; try { $ minimum = $ db -> fetchColumn ( 'select min(version) from SystemDatabaseMigrations' ) ; } catch ( Exception $ e ) { return ; } $ migrations = $ this -> getMigra... | This is a stupid requirement but basically we grab the lowest version number in our system database migrations table and we loop through all migrations in our file system and for any of those LOWER than the lowest one in the table we can assume they are included in this migration . We then manually insert these rows in... |
9,806 | protected function findInitialMigrationByCoreVersion ( $ coreVersion , $ criteria ) { $ coreVersionNormalized = preg_replace ( '/(\.0+)+$/' , '' , $ coreVersion ) ; if ( version_compare ( $ coreVersionNormalized , '5.7' ) < 0 ) { throw new Exception ( t ( 'Invalid version specified (%s).' , $ coreVersion ) ) ; } $ migr... | Get the initial migration starting from a core version . |
9,807 | protected function getFinalHrefLang ( ) { $ result = $ this -> getOverriddenHrefLang ( ) ; if ( $ result === '' ) { $ result = strtolower ( str_replace ( '_' , '-' , $ this -> getSection ( ) -> getLocale ( ) ) ) ; } return $ result ; } | Get the final value of the href lang . |
9,808 | public function generateGatheringItems ( ) { $ configuredDataSources = $ this -> getConfiguredGatheringDataSources ( ) ; $ items = array ( ) ; foreach ( $ configuredDataSources as $ configuration ) { $ dataSource = $ configuration -> getGatheringDataSourceObject ( ) ; $ dataSourceItems = $ dataSource -> createGathering... | Runs through all active gathering data sources creates GatheringItem objects . |
9,809 | public function areEqual ( RepetitionInterface $ r1 , RepetitionInterface $ r2 ) { if ( $ r1 -> getStartDate ( ) != $ r2 -> getStartDate ( ) ) { return false ; } if ( $ r1 -> getTimezone ( ) -> getName ( ) != $ r2 -> getTimezone ( ) -> getName ( ) ) { return false ; } if ( $ r1 -> getEndDate ( ) != $ r2 -> getEndDate (... | Returns true if the two repetitions are equal . |
9,810 | public function process ( Request $ request , DelegateInterface $ frame ) { $ response = $ frame -> next ( $ request ) ; if ( $ response && $ this -> app -> isInstalled ( ) && $ this -> config -> get ( 'concrete.misc.basic_thumbnailer_generation_strategy' ) == 'now' ) { $ responseStatusCode = ( int ) $ response -> getS... | Process the request and return a response . |
9,811 | private function generateThumbnail ( array $ thumbnail ) { $ file = $ this -> getEntityManager ( ) -> find ( File :: class , $ thumbnail [ 'fileID' ] ) ; if ( $ this -> attemptBuild ( $ file , $ thumbnail ) ) { $ result = true ; } else { $ this -> failBuild ( $ file , $ thumbnail ) ; $ result = false ; } return $ resul... | Generate a thumbnail . |
9,812 | private function markThumbnailAsBuilt ( Connection $ connection , array $ thumbnail , $ built = true ) { $ key = $ thumbnail ; unset ( $ key [ 'lockID' ] ) ; unset ( $ key [ 'lockExpires' ] ) ; unset ( $ key [ 'path' ] ) ; unset ( $ key [ 'isBuilt' ] ) ; $ connection -> update ( 'FileImageThumbnailPaths' , [ 'isBuilt' ... | Mark a thumbnail as built or not . |
9,813 | private function failBuild ( File $ file , array $ thumbnail ) { $ this -> app -> make ( LoggerInterface :: class ) -> critical ( 'Failed to generate or locate the thumbnail for file "' . $ file -> getFileID ( ) . '"' ) ; } | Mark the build failed . |
9,814 | public function action ( $ action ) { $ a = func_get_args ( ) ; $ controllerPath = $ this -> controller -> getControllerActionPath ( ) ; array_unshift ( $ a , $ controllerPath ) ; $ ret = call_user_func_array ( [ $ this , 'url' ] , $ a ) ; return $ ret ; } | A shortcut to posting back to the current page with a task and optional parameters . Only works in the context of . |
9,815 | protected function loadViewThemeObject ( ) { $ env = Environment :: get ( ) ; $ app = Facade :: getFacadeApplication ( ) ; $ tmpTheme = $ app -> make ( ThemeRouteCollection :: class ) -> getThemeByRoute ( $ this -> getViewPath ( ) ) ; if ( isset ( $ tmpTheme [ 0 ] ) ) { $ this -> themeHandle = $ tmpTheme [ 0 ] ; } if (... | Load all the theme - related variables for which theme to use for this request . May update the themeHandle property on the view based on themeByRoute settings . |
9,816 | public function view ( ) { $ this -> set ( 'trustedProxyUrl' , $ this -> urls -> resolve ( [ '/dashboard/system/permissions/trusted_proxies' ] ) ) ; $ this -> set ( 'invalidateOnIPMismatch' , $ this -> config -> get ( self :: ITEM_IP ) ) ; $ this -> set ( 'invalidateOnUserAgentMismatch' , $ this -> config -> get ( self... | Main view function for the controller . This method is called when no other action matches the request |
9,817 | public function save ( ) { if ( ! $ this -> token -> validate ( 'save_automated_logout' ) ) { $ this -> error -> add ( $ this -> token -> getErrorMessage ( ) ) ; $ this -> flash ( 'error' , $ this -> error ) ; return $ this -> factory -> redirect ( $ this -> action ( ) ) ; } $ post = $ this -> request -> request ; $ th... | An action for saving the Session Security form This method will manage saving settings and redirecting to the appropriate results page |
9,818 | public function invalidate_sessions ( $ token = '' ) { if ( ! $ this -> token -> validate ( 'invalidate_sessions' , $ token ) ) { $ this -> error -> add ( $ this -> token -> getErrorMessage ( ) ) ; $ this -> flash ( 'error' , $ this -> error ) ; return $ this -> factory -> redirect ( $ this -> action ( ) ) ; } $ this -... | An action for invalidating all active sessions |
9,819 | protected function invalidateSessions ( ) { $ this -> config -> save ( self :: ITEM_SESSION_INVALIDATE , Carbon :: now ( 'utc' ) -> getTimestamp ( ) ) ; $ this -> app -> make ( 'session' ) -> invalidate ( ) ; } | Invalidate all user sessions |
9,820 | public function filterByApprovedAfter ( \ DateTime $ date ) { $ this -> query -> andWhere ( 'cv.cvDateApproved >= ' . $ this -> query -> createNamedParameter ( $ date -> format ( 'Y-m-d H:i-s' ) ) ) ; } | Filter versions that are approved after a certain date . |
9,821 | public function filterByApprovedBefore ( \ DateTime $ date ) { $ this -> query -> andWhere ( 'cv.cvDateApproved <= ' . $ this -> query -> createNamedParameter ( $ date -> format ( 'Y-m-d H:i-s' ) ) ) ; } | Filter versions that are approved before a certain date . |
9,822 | public function persist ( StorageLocationEntity $ storageLocation ) { return $ this -> entityManager -> transactional ( function ( EntityManagerInterface $ em ) use ( $ storageLocation ) { if ( $ storageLocation -> isDefault ( ) ) { $ qb = $ em -> createQueryBuilder ( ) -> update ( StorageLocationEntity :: class , 'l' ... | Store a created storage location to the database |
9,823 | protected function bindContainer ( Application $ app ) { $ this -> app -> when ( PasswordUsageTracker :: class ) -> needs ( '$maxReuse' ) -> give ( function ( ) { return $ this -> app [ 'config' ] -> get ( 'concrete.user.password.reuse.track' , 5 ) ; } ) ; $ this -> app -> bindShared ( 'user/registration' , function ( ... | Bind things to the container |
9,824 | public function handleEvent ( Event $ event , UserNotificationEventHandler $ service ) { if ( ! $ event instanceof DeactivateUser ) { return ; } $ entity = $ event -> getUserEntity ( ) ; if ( $ entity ) { $ service -> deactivated ( $ event ) ; } } | Handle routing bound events |
9,825 | public static function getAvailableThemes ( $ filterInstalled = true ) { $ db = Loader :: db ( ) ; $ dh = Loader :: helper ( 'file' ) ; $ themes = $ dh -> getDirectoryContents ( DIR_FILES_THEMES ) ; if ( $ filterInstalled ) { $ handles = $ db -> GetCol ( 'select pThemeHandle from PageThemes' ) ; $ themesTemp = [ ] ; fo... | scans the directory for available themes . For those who don t want to go through the hassle of uploading . |
9,826 | public function getThemeCustomizableStyleList ( ) { if ( ! isset ( $ this -> styleList ) ) { $ env = Environment :: get ( ) ; $ r = $ env -> getRecord ( DIRNAME_THEMES . '/' . $ this -> getThemeHandle ( ) . '/' . DIRNAME_CSS . '/' . FILENAME_STYLE_CUSTOMIZER_STYLES , $ this -> getPackageHandle ( ) ) ; $ this -> styleLi... | Gets the style list object for this theme . |
9,827 | public function getThemeCustomizablePreset ( $ handle ) { $ env = Environment :: get ( ) ; if ( $ this -> isThemeCustomizable ( ) ) { $ file = $ env -> getRecord ( DIRNAME_THEMES . '/' . $ this -> getThemeHandle ( ) . '/' . DIRNAME_CSS . '/' . DIRNAME_STYLE_CUSTOMIZER_PRESETS . '/' . $ handle . static :: THEME_CUSTOMIZ... | Gets a preset for this theme by handle . |
9,828 | public function getThemeCustomizableStylePresets ( ) { $ presets = [ ] ; $ env = Environment :: get ( ) ; if ( $ this -> isThemeCustomizable ( ) ) { $ directory = $ env -> getPath ( DIRNAME_THEMES . '/' . $ this -> getThemeHandle ( ) . '/' . DIRNAME_CSS . '/' . DIRNAME_STYLE_CUSTOMIZER_PRESETS , $ this -> getPackageHan... | Gets all presets available to this theme . |
9,829 | public function getStylesheet ( $ stylesheet ) { $ stylesheet = $ this -> getStylesheetObject ( $ stylesheet ) ; $ styleValues = $ this -> getThemeCustomStyleObjectValues ( ) ; if ( ! is_null ( $ styleValues ) ) { $ stylesheet -> setValueList ( $ styleValues ) ; } if ( ! $ this -> isThemePreviewRequest ( ) ) { if ( ! $... | Looks into the current CSS directory and returns a fully compiled stylesheet when passed a LESS stylesheet . Also serves up custom value list values for the stylesheet if they exist . |
9,830 | public function getThemeCustomStyleObject ( ) { $ db = Loader :: db ( ) ; $ row = $ db -> FetchAssoc ( 'select * from PageThemeCustomStyles where pThemeID = ?' , [ $ this -> getThemeID ( ) ] ) ; if ( isset ( $ row [ 'pThemeID' ] ) ) { $ o = new \ Concrete \ Core \ Page \ CustomStyle ( ) ; $ o -> setThemeID ( $ this -> ... | Returns a Custom Style Object for the theme if one exists . |
9,831 | public function getFilesInTheme ( ) { $ dh = Loader :: helper ( 'file' ) ; $ templateList = PageTemplate :: getList ( ) ; $ pts = [ ] ; foreach ( $ templateList as $ pt ) { $ pts [ ] = $ pt -> getPageTemplateHandle ( ) ; } $ files = [ ] ; $ filesTmp = $ dh -> getDirectoryContents ( $ this -> pThemeDirectory ) ; foreach... | lists them out by type allowing people to install them as page type etc ... |
9,832 | public function generate ( $ table , $ key , $ length = 12 , $ lowercase = false ) { $ foundHash = false ; $ db = Application :: make ( Connection :: class ) ; while ( $ foundHash == false ) { $ string = $ this -> getString ( $ length ) ; if ( $ lowercase ) { $ string = strtolower ( $ string ) ; } $ cnt = $ db -> GetOn... | Generates a unique identifier for an item in a database table . Used among other places in generating User hashes for email validation . |
9,833 | public function getString ( $ length = 12 ) { $ size = ceil ( $ length / 2 ) ; try { if ( function_exists ( 'random_bytes' ) ) { $ bytes = random_bytes ( $ size ) ; } else { $ hash = new PasswordHash ( 8 , false ) ; $ bytes = $ hash -> get_random_bytes ( $ size ) ; } } catch ( \ Exception $ e ) { die ( 'Could not gener... | Generate a cryptographically secure random string |
9,834 | public static function decrypt ( $ text ) { if ( function_exists ( 'mcrypt_decrypt' ) ) { $ iv_size = mcrypt_get_iv_size ( MCRYPT_XTEA , MCRYPT_MODE_ECB ) ; $ iv = mcrypt_create_iv ( $ iv_size , MCRYPT_RAND ) ; $ len = mcrypt_get_key_size ( MCRYPT_XTEA , MCRYPT_MODE_ECB ) ; $ config = \ Core :: make ( 'config/database'... | Takes encrypted text and decrypts it . |
9,835 | public static function encrypt ( $ text ) { if ( function_exists ( 'mcrypt_encrypt' ) ) { $ iv_size = mcrypt_get_iv_size ( MCRYPT_XTEA , MCRYPT_MODE_ECB ) ; $ iv = mcrypt_create_iv ( $ iv_size , MCRYPT_RAND ) ; $ len = mcrypt_get_key_size ( MCRYPT_XTEA , MCRYPT_MODE_ECB ) ; $ config = \ Core :: make ( 'config/database'... | Takes un - encrypted text and encrypts it . |
9,836 | public function trackUse ( $ string , $ subject ) { $ id = $ this -> resolveUserID ( $ subject ) ; if ( ! $ id ) { return false ; } if ( ! is_string ( $ string ) ) { throw new \ InvalidArgumentException ( t ( 'Invalid mixed value provided. Must be a string.' ) ) ; } if ( $ this -> maxReuse ) { $ this -> entityManager -... | Track a string being used |
9,837 | private function pruneUses ( $ subject ) { $ repository = $ this -> entityManager -> getRepository ( UsedString :: class ) ; $ usedStrings = $ repository -> findBy ( [ 'subject' => $ subject ] , [ 'id' => 'desc' ] ) ; if ( count ( $ usedStrings ) > $ this -> maxReuse ) { array_map ( [ $ this -> entityManager , 'remove'... | Prune uses for a specific subject |
9,838 | public function getImagePath ( $ uo , $ withNoCacheStr = true ) { if ( ! $ uo -> hasAvatar ( ) ) { return false ; } $ avatar = $ uo -> getUserAvatar ( ) ; return $ avatar -> getPath ( ) ; } | gets the image path for a users avatar . |
9,839 | protected function pagesToQueue ( ) { $ qb = $ this -> connection -> createQueryBuilder ( ) ; $ timeout = intval ( $ this -> app [ 'config' ] -> get ( 'concrete.misc.page_search_index_lifetime' ) ) ; $ query = $ qb -> select ( 'p.cID' ) -> from ( 'Pages' , 'p' ) -> leftJoin ( 'p' , 'CollectionSearchIndexAttributes' , '... | Get Pages to add to the queue |
9,840 | public static function key ( $ group , $ id ) { if ( ! empty ( $ id ) ) { return trim ( $ group , '/' ) . '/' . trim ( $ id , '/' ) ; } else { return trim ( $ group , '/' ) ; } } | Creates a cache key based on the group and id by running it through md5 . |
9,841 | protected function log ( $ level , $ message , array $ context = [ ] ) { if ( $ this -> logger ) { $ metadata = $ this -> getMetadataBag ( ) ; $ context [ 'metadata' ] = [ 'created' => $ metadata -> getCreated ( ) , 'lifetime' => $ metadata -> getLifetime ( ) , 'lastused' => $ metadata -> getLastUsed ( ) , 'name' => $ ... | Log details if possible |
9,842 | public function clear ( ) { $ this -> logInfo ( 'Clearing Session.' ) ; $ metadata = $ this -> getMetadataBag ( ) ; $ lifetime = $ metadata -> getLifetime ( ) ; $ lastUsed = $ metadata -> getLastUsed ( ) ; if ( $ lifetime && time ( ) > $ lastUsed + $ lifetime ) { $ this -> logInfo ( 'Session expired.' ) ; } return $ th... | Clear all session data in memory . |
9,843 | protected function getFileRecord ( $ file ) { $ result = null ; $ segment = implode ( '/' , [ DIRNAME_GEOLOCATION , $ this -> geolocator -> getGeolocatorHandle ( ) , $ file ] ) ; $ fileLocator = $ this -> app -> make ( FileLocator :: class ) ; $ package = $ this -> geolocator -> getGeolocatorPackage ( ) ; if ( $ packag... | Get the path to a geolocator file . |
9,844 | protected function getCaches ( ) { foreach ( $ this -> caches as $ key => $ cache ) { if ( ! $ cache instanceof FlushableInterface ) { $ cache = $ this -> application -> make ( $ cache ) ; } if ( $ cache instanceof FlushableInterface ) { yield $ key => $ cache ; } } } | A generator that populates the cache objects from the container |
9,845 | protected function clearCacheDirectory ( $ directory ) { foreach ( $ this -> filesToClear ( $ directory ) as $ file ) { if ( $ file -> isDir ( ) ) { $ this -> filesystem -> deleteDirectory ( $ file -> getPathname ( ) ) ; } else { $ this -> filesystem -> delete ( $ file -> getPathname ( ) ) ; } } } | Clear out items from the cache directory |
9,846 | public function getPlaceHolderText ( $ handle ) { $ pageValues = $ this -> getAvailablePageValues ( ) ; if ( in_array ( $ handle , array_keys ( $ pageValues ) ) ) { $ placeHolder = $ pageValues [ $ handle ] ; } else { $ attributeKey = CollectionAttributeKey :: getByHandle ( $ handle ) ; if ( is_object ( $ attributeKey ... | Returns a place holder for pages that are new or when editing default page types . |
9,847 | public function alphanum ( $ value , $ allowSpaces = false , $ allowDashes = false ) { $ allowedCharsRegex = 'A-Za-z0-9' ; if ( $ allowSpaces ) { $ allowedCharsRegex .= ' ' ; } if ( $ allowDashes ) { $ allowedCharsRegex .= '\-' ; } return $ this -> notempty ( $ value ) && ! preg_match ( '/[^' . $ allowedCharsRegex . ']... | Returns true on whether the passed string is completely alpha - numeric if the value is not a string or is an empty string false will be returned . |
9,848 | public function min ( $ str , $ length ) { return $ this -> notempty ( $ str ) && strlen ( trim ( $ str ) ) >= $ length ; } | Returns true on whether the passed string is larger or equal to the passed length . |
9,849 | public function max ( $ str , $ length ) { return $ this -> notempty ( $ str ) && strlen ( trim ( $ str ) ) <= $ length ; } | Returns true on whether the passed is smaller or equal to the passed length . |
9,850 | public function setInstalledPackages ( array $ installedPackages ) { $ dictionary = [ ] ; foreach ( $ installedPackages as $ installedPackage ) { $ dictionary [ $ installedPackage -> getPackageHandle ( ) ] = $ installedPackage ; } $ this -> installedPackages = $ dictionary ; return $ this ; } | Set the list of installed packages . |
9,851 | protected function getInstalledPackages ( ) { if ( $ this -> installedPackages === null ) { $ installedPackages = [ ] ; $ packageService = $ this -> application -> make ( PackageService :: class ) ; foreach ( $ packageService -> getInstalledHandles ( ) as $ packageHandle ) { $ installedPackages [ $ packageHandle ] = $ ... | Get the list of installed packages . |
9,852 | protected function getPackageRequirementsForPackage ( Package $ package , Package $ otherPackage ) { $ dependencies = $ package -> getPackageDependencies ( ) ; $ otherPackageHandle = $ otherPackage -> getPackageHandle ( ) ; return isset ( $ dependencies [ $ otherPackageHandle ] ) ? $ dependencies [ $ otherPackageHandle... | Get the requirements for a package in respect to another package . |
9,853 | public function getAreaLayoutColumnOffsetEditClass ( ) { $ gf = $ this -> arLayout -> getThemeGridFrameworkObject ( ) ; if ( is_object ( $ gf ) ) { $ class = $ gf -> getPageThemeGridFrameworkColumnAdditionalClasses ( ) ; if ( $ class ) { $ class .= ' ' ; } $ class .= $ gf -> getPageThemeGridFrameworkColumnClassForSpan ... | this returns offsets in the form of spans . |
9,854 | protected function getInstaller ( ) { if ( $ this -> installer === null ) { $ this -> installer = $ this -> app -> make ( Installer :: class ) ; } return $ this -> installer ; } | Get the installer instance . |
9,855 | public function load ( $ environment , $ group , $ namespace = null ) { $ result = array ( ) ; $ db = Database :: getActiveConnection ( ) ; $ query = $ db -> createQueryBuilder ( ) ; $ query -> select ( 'configValue' , 'configItem' ) -> from ( 'Config' , 'c' ) -> where ( 'configGroup = ?' ) -> setParameter ( 0 , $ grou... | Load the given configuration group . Because it s the database we ignore the environment . |
9,856 | public function getNamespaces ( ) { $ db = Database :: getActiveConnection ( ) ; $ results = $ db -> createQueryBuilder ( ) -> select ( 'configNamespace' ) -> from ( 'Config' , 'c' ) -> where ( 'configNamespace != ""' ) -> groupBy ( 'configNamespace' ) -> execute ( ) ; return array_map ( 'array_shift' , $ results -> fe... | Returns all registered namespaces with the config loader . |
9,857 | public function boot ( ) { $ app = $ this -> app ; Facade :: setFacadeApplication ( $ app ) ; require_once DIR_BASE_CORE . '/bootstrap/paths.php' ; $ this -> initializeEnvironmentDetection ( $ app ) ; $ config = $ this -> initializeConfig ( $ app ) ; $ this -> setupErrorReporting ( $ config ) ; $ this -> initializeLoca... | Boot up Return a response if we re ready to output . |
9,858 | private function initializeConfig ( Application $ app ) { $ config_provider = $ app -> make ( 'Concrete\Core\Config\ConfigServiceProvider' ) ; $ config_provider -> register ( ) ; $ config = $ app -> make ( 'config' ) ; return $ config ; } | Enable configuration . |
9,859 | private function setupErrorReporting ( Repository $ config ) { $ error_reporting = $ config -> get ( 'concrete.debug.error_reporting' ) ; if ( ( string ) $ error_reporting !== '' ) { error_reporting ( ( int ) $ error_reporting ) ; } } | Setup the configured error reporting . |
9,860 | private function validateDatabaseDetails ( $ environment ) { $ db_config = [ ] ; $ configFile = DIR_CONFIG_SITE . '/database.php' ; $ environmentConfig = DIR_CONFIG_SITE . "/{$environment}.database.php" ; if ( file_exists ( $ configFile ) ) { $ db_config = include DIR_CONFIG_SITE . '/database.php' ; } if ( file_exists ... | Check whether an environment has well formed database credentials defined |
9,861 | private function checkInstall ( Application $ app , Request $ request ) { if ( ! $ app -> isInstalled ( ) ) { if ( ! $ request -> matches ( '/install/*' ) && $ request -> getPath ( ) != '/install' && ! $ request -> matches ( '/ccm/assets/localization/*' ) ) { $ manager = $ app -> make ( 'Concrete\Core\Url\Resolver\Mana... | If we haven t installed and we re not looking at the install directory redirect . |
9,862 | public function getGatheringItemTemplateSlotWidth ( GatheringItem $ item ) { if ( $ this -> getGatheringItemTemplateFixedSlotWidth ( ) ) { return $ this -> getGatheringItemTemplateFixedSlotWidth ( ) ; } $ w = 0 ; $ handles = $ this -> getGatheringItemTemplateFeatureHandles ( ) ; $ assignments = \ Concrete \ Core \ Feat... | This method is called by GatheringItem when setting defaults . |
9,863 | public function clearNamespace ( $ namespace ) { $ paths = $ this -> getNamespaceDefaultPaths ( $ namespace ) ; foreach ( $ paths as $ path ) { if ( $ this -> files -> isDirectory ( $ path ) ) { $ this -> files -> deleteDirectory ( $ path ) ; } } } | Clear groups in a namespace . |
9,864 | private function projectList ( UserList $ list ) { $ statement = $ list -> deliverQueryObject ( ) -> execute ( ) ; foreach ( $ statement as $ result ) { $ user = $ list -> getResult ( $ result ) ; yield iterator_to_array ( $ this -> projectUser ( $ user ) ) ; } } | A generator that takes a UserList and converts it to CSV rows |
9,865 | private function projectUser ( UserInfo $ user ) { yield $ user -> getUserName ( ) ; yield $ user -> getUserEmail ( ) ; $ userRegistrationDate = $ user -> getUserDateAdded ( ) ; yield $ this -> date -> formatCustom ( \ DateTime :: ATOM , $ userRegistrationDate ) ; list ( $ active , $ inactive ) = $ this -> getTranslate... | Turn a user into an array |
9,866 | private function getAttributeKeys ( ) { if ( ! isset ( $ this -> attributeKeys ) ) { $ this -> attributeKeys = $ this -> category -> getList ( ) ; } return $ this -> attributeKeys ; } | Memoize the attribute keys so that we aren t looking them up over and over |
9,867 | private function getTranslatedStatus ( ) { if ( $ this -> status === null ) { $ this -> status = [ t ( 'Active' ) , t ( 'Inactive' ) ] ; } return $ this -> status ; } | Get the translated status texts |
9,868 | public function report ( $ content , $ author , $ email , $ ip , $ ua , $ additionalArgs = array ( ) ) { $ args [ 'content' ] = $ content ; $ args [ 'author' ] = $ author ; $ args [ 'author_email' ] = $ email ; $ args [ 'ip_address' ] = $ ip ; $ args [ 'user_agent' ] = $ ua ; foreach ( $ additionalArgs as $ key => $ va... | Report some content with the poster s information to the AntiSpam service . |
9,869 | public function run ( ) { $ console = $ this -> console ; $ this -> app -> instance ( 'console' , $ console ) ; $ this -> loadBootstrap ( ) ; $ this -> initializeSystemTimezone ( ) ; $ input = new ArgvInput ( ) ; if ( $ input -> getFirstArgument ( ) !== 'c5:update' ) { if ( $ this -> app -> isInstalled ( ) ) { $ this -... | Run the runtime . |
9,870 | protected function getConfiguredRule ( $ configuration , RuleInterface $ rule ) { $ configurationNormalized = str_replace ( array ( "\r\n" , "\r" ) , "\n" , ( string ) $ configuration ) ; $ rxSearch = '/' ; $ rxSearch .= '(^|\n)' ; $ commentsBefore = $ rule -> getCommentsBefore ( ) ; if ( $ commentsBefore !== '' ) { $ ... | Gets the rule if present in a configuration . |
9,871 | public static function getByID ( $ cID , $ cvID = 'RECENT' ) { $ entity = self :: getLocaleFromHomePageID ( $ cID ) ; if ( $ entity ) { $ obj = parent :: getByID ( $ cID , $ cvID ) ; $ obj -> setLocale ( $ entity ) ; return $ obj ; } return false ; } | Returns an instance of MultilingualSection for the given page ID . |
9,872 | public static function getCurrentSection ( ) { static $ lang ; if ( ! isset ( $ lang ) ) { $ c = Page :: getCurrentPage ( ) ; if ( $ c instanceof Page ) { $ lang = self :: getBySectionOfSite ( $ c ) ; } } return $ lang ; } | Gets the MultilingualSection object for the current section of the site . |
9,873 | public function getTranslatedPageID ( $ page ) { $ ids = static :: getIDList ( ) ; if ( in_array ( $ page -> getCollectionID ( ) , $ ids ) ) { return $ this -> locale -> getSiteTree ( ) -> getSiteHomePageID ( ) ; } $ mpRelationID = self :: getMultilingualPageRelationID ( $ page -> getCollectionID ( ) ) ; if ( $ mpRelat... | Receives a page in a different language tree and tries to return the corresponding page in the current language tree . |
9,874 | public function getSectionInterfaceTranslations ( $ untranslatedFirst = false ) { $ translations = new Translations ( ) ; $ translations -> setLanguage ( $ this -> getLocale ( ) ) ; $ translations -> setPluralForms ( $ this -> getNumberOfPluralForms ( ) , $ this -> getPluralsRule ( ) ) ; $ db = \ Database :: get ( ) ; ... | Loads the translations of this multilingual section . |
9,875 | public function generatePageList ( ) { $ this -> now = new DateTime ( ) ; $ siteTreeIDList = array_merge ( [ 0 ] , $ this -> getSiteTreesIDList ( ) ) ; $ connection = $ this -> getConnection ( ) ; $ rs = $ connection -> executeQuery ( 'select cID from Pages where siteTreeID is null or siteTreeID in (' . implode ( ', ' ... | Generate the list of pages that should be included in the sitemap . |
9,876 | public function isMultilingualEnabled ( ) { if ( $ this -> isMultilingualEnabled === null ) { $ this -> isMultilingualEnabled = count ( $ this -> getMultilingualSections ( ) ) > 1 ; } return $ this -> isMultilingualEnabled ; } | Check if the current site has more than one multilingual section . |
9,877 | public function getMultilingualSections ( ) { if ( $ this -> multilingualSections === null ) { $ site = $ this -> getSite ( ) ; if ( $ site === null ) { $ this -> multilingualSections = [ ] ; } else { $ list = [ ] ; foreach ( MultilingualSection :: getList ( $ site ) as $ section ) { $ list [ $ section -> getCollection... | Get the list of multilingual sections defined for the current site . |
9,878 | public function canIncludePageInSitemap ( Page $ page ) { $ result = false ; if ( $ this -> isPageStandard ( $ page ) ) { if ( $ this -> isPagePublished ( $ page ) ) { if ( ! $ this -> isPageExcludedFromSitemap ( $ page ) ) { if ( $ this -> isPageAccessible ( $ page ) ) { $ result = true ; } } } } return $ result ; } | Should a page be included in the sitemap? |
9,879 | public function getSite ( ) { if ( $ this -> site === false ) { $ this -> site = $ this -> app -> make ( 'site' ) -> getDefault ( ) ; } return $ this -> site ; } | Get the currently used site . |
9,880 | public function setSite ( Site $ site ) { if ( $ this -> site !== $ site ) { $ this -> site = $ site ; $ this -> multilingualSections = null ; $ this -> isMultilingualEnabled = null ; } return $ this ; } | Set the currently used site . |
9,881 | public function swapContent ( Package $ package , $ options ) { if ( $ this -> validateClearSiteContents ( $ options ) ) { \ Core :: make ( 'cache/request' ) -> disable ( ) ; $ pl = new PageList ( ) ; $ pages = $ pl -> getResults ( ) ; foreach ( $ pages as $ c ) { $ c -> delete ( ) ; } $ fl = new FileList ( ) ; $ files... | Removes any existing pages files stacks block and page types and installs content from the package . |
9,882 | protected function resolveMethods ( ) { $ methods = $ this -> reflectionClass -> getMethods ( ) ; if ( $ this -> isFacade ( ) ) { $ methods = array_merge ( $ methods , $ this -> getFacadeReflectionClass ( ) -> getMethods ( ) ) ; } foreach ( $ methods as $ method ) { $ this -> methods [ ] = new MethodSymbol ( $ this , $... | Get the methods . |
9,883 | public function render ( $ eol = "\n" , $ padding = ' ' , $ methodFilter = null ) { $ rendered = '' ; $ comment = $ this -> comment ; if ( $ comment !== false ) { $ comment = trim ( $ comment ) ; if ( $ comment !== '' ) { $ rendered .= str_replace ( $ eol . '*' , $ eol . ' *' , implode ( $ eol , array_map ( 'trim' ,... | Render Class with methods . |
9,884 | public function getCompatibleTimezones ( ) { $ validTimezones = [ ] ; foreach ( $ this -> dateHelper -> getTimezones ( ) as $ timezoneID => $ timezoneName ) { if ( $ this -> getDeltaTimezone ( $ timezoneID ) === null ) { $ validTimezones [ $ timezoneID ] = $ timezoneName ; } } return $ validTimezones ; } | Get a list of time zones that are compatible with the database . |
9,885 | public function getDeltaTimezone ( $ phpTimezone ) { if ( ! ( $ phpTimezone instanceof DateTimeZone ) ) { $ phpTimezone = new DateTimeZone ( $ phpTimezone ) ; } $ data = $ this -> getDatabaseTimestamps ( ) ; extract ( $ data ) ; $ sometimesSame = false ; $ maxDeltaMinutes = 0 ; foreach ( $ timestamps as $ index => $ ti... | Check if a PHP time zone is compatible with the database timezone . |
9,886 | public function getItemsPerPageSession ( ) { $ variable = 'search/' . $ this -> getSessionNamespace ( ) . '/items_per_page' ; if ( $ this -> session -> has ( $ variable ) ) { return ( int ) $ this -> session -> get ( $ variable ) ; } return null ; } | Retrieve the items per page option from the session . |
9,887 | private function attemptBuild ( File $ file , array $ thumbnail ) { try { if ( $ this -> isBuilt ( $ file , $ thumbnail ) ) { return true ; } if ( $ dimensions = $ this -> getDimensions ( $ thumbnail ) ) { list ( $ width , $ height , $ crop ) = $ dimensions ; $ type = new CustomThumbnail ( $ width , $ height , $ thumbn... | Try building an unbuilt thumbnail . |
9,888 | private function getDimensions ( $ thumbnail ) { $ matches = null ; if ( preg_match ( '/^ccm_(\d+)x(\d+)(?:_([10]))?$/' , $ thumbnail [ 'thumbnailTypeHandle' ] , $ matches ) ) { return array_pad ( array_slice ( $ matches , 1 ) , 3 , 0 ) ; } } | Get the dimensions out of a thumbnail array . |
9,889 | protected function selectNearestValue ( array $ values , $ wantedValue ) { if ( in_array ( $ wantedValue , $ values ) ) { $ result = $ wantedValue ; } else { $ result = null ; $ minDelta = PHP_INT_MAX ; foreach ( $ values as $ value ) { $ delta = abs ( $ value - $ wantedValue ) ; if ( $ delta < $ minDelta ) { $ minDelt... | Choose an array value nearest to a specified value . Useful when we work with time resolutions . |
9,890 | public function getNewUsernameFromUserDetails ( $ email , $ suggestedUsername = '' , $ firstName = '' , $ lastName = '' ) { $ baseUsername = $ this -> stringToUsernameChunk ( $ suggestedUsername ) ; if ( $ baseUsername === '' ) { $ firstName = $ this -> stringToUsernameChunk ( $ firstName ) ; $ lastName = $ this -> str... | Create an unused username starting from user details . |
9,891 | public function getIndexes ( $ type , $ includeGlobal = true ) { if ( isset ( $ this -> indexes [ $ type ] ) ) { foreach ( $ this -> indexes [ $ type ] as $ index ) { yield $ type => $ this -> inflateIndex ( $ index ) ; } } $ all = self :: TYPE_ALL ; if ( $ type !== $ all && $ includeGlobal ) { if ( isset ( $ this -> i... | Get the indexes for a type |
9,892 | protected function inflateIndex ( $ class ) { if ( $ class instanceof IndexInterface ) { return $ class ; } if ( ! isset ( $ this -> inflated [ $ class ] ) ) { $ this -> inflated [ $ class ] = $ this -> app -> make ( $ class ) ; } return $ this -> inflated [ $ class ] ; } | Get the proper index from the stored value |
9,893 | public function getAllIndexes ( ) { foreach ( $ this -> indexes as $ type => $ indexList ) { if ( $ type == self :: TYPE_ALL ) { continue ; } foreach ( $ this -> getIndexes ( $ type , false ) as $ index ) { yield $ type => $ index ; } } foreach ( $ this -> getIndexes ( self :: TYPE_ALL ) as $ index ) { yield self :: TY... | Get all indexes registered against this manager |
9,894 | public function addIndex ( $ type , $ index ) { if ( ! isset ( $ this -> indexes [ $ type ] ) ) { $ this -> indexes [ $ type ] = [ ] ; } $ this -> indexes [ $ type ] [ ] = $ index ; } | Add an index to this manager |
9,895 | public function index ( $ type , $ object ) { foreach ( $ this -> getIndexes ( $ type ) as $ index ) { $ index -> index ( $ object ) ; } } | Index an object |
9,896 | public function forget ( $ type , $ object ) { foreach ( $ this -> getIndexes ( $ type ) as $ index ) { $ index -> forget ( $ object ) ; } } | Forget an object |
9,897 | private function deleteFormAnswers ( $ qsID ) { $ db = Loader :: db ( ) ; $ v = [ intval ( $ qsID ) ] ; $ q = 'SELECT asID FROM btFormAnswerSet WHERE questionSetId = ?' ; $ r = $ db -> query ( $ q , $ v ) ; while ( $ row = $ r -> fetchRow ( ) ) { $ asID = $ row [ 'asID' ] ; $ this -> deleteAnswers ( $ asID ) ; } } | DELETE A FORM ANSWERS |
9,898 | private function deleteForm ( $ bID , $ qsID ) { $ db = Loader :: db ( ) ; $ this -> deleteFormAnswers ( $ qsID ) ; $ v = [ intval ( $ bID ) ] ; $ q = 'DELETE FROM btFormQuestions WHERE bID = ?' ; $ r = $ db -> query ( $ q , $ v ) ; $ q = 'DELETE FROM btForm WHERE bID = ?' ; $ r = $ db -> query ( $ q , $ v ) ; $ q = 'D... | DELETE FORMS AND ALL SUBMISSIONS |
9,899 | private function viewRequiresJqueryUI ( ) { $ whereInputTypes = "inputType = 'date' OR inputType = 'datetime'" ; $ sql = "SELECT COUNT(*) FROM {$this->btQuestionsTablename} WHERE questionSetID = ? AND bID = ? AND ({$whereInputTypes})" ; $ vals = [ intval ( $ this -> questionSetId ) , intval ( $ this -> bID ) ] ; $ JQUI... | Internal helper function . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.