idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
10,000
public function create ( ) { $ this -> add ( ) ; $ this -> validateIntegrationRequest ( ) ; if ( ! $ this -> token -> validate ( 'create' ) ) { $ this -> error -> add ( $ this -> token -> getErrorMessage ( ) ) ; } if ( $ this -> error -> has ( ) ) { return ; } $ factory = $ this -> app -> make ( ClientFactory :: class ...
Request handler to create new client objects
10,001
public function getString ( ) { $ html = '' ; if ( $ this -> error -> has ( ) ) { $ html .= '<ul class="ccm-error">' ; foreach ( $ this -> error -> getList ( ) as $ error ) { $ html .= '<li>' ; if ( $ error instanceof HtmlAwareErrorInterface && $ error -> messageContainsHtml ( ) ) { $ html .= ( string ) $ error ; } els...
Build an HTML - formatted string describing the errors .
10,002
public function view ( $ strStatus = false ) { $ config = $ this -> app -> make ( 'config' ) ; $ strStatus = ( string ) $ strStatus ; $ intLogErrors = $ config -> get ( 'concrete.log.errors' ) == 1 ? 1 : 0 ; $ intLogEmails = $ config -> get ( 'concrete.log.emails' ) == 1 ? 1 : 0 ; $ this -> set ( 'fh' , Loader :: helpe...
Dasboard page view .
10,003
public function update_logging ( ) { $ config = $ this -> app -> make ( 'config' ) ; if ( ! $ this -> token -> validate ( 'update_logging' ) ) { $ this -> error -> add ( $ this -> token -> getErrorMessage ( ) ) ; } if ( $ this -> request -> request -> get ( 'handler' ) == 'file' && $ this -> request -> request -> get (...
Updates logging settings .
10,004
public function createConnection ( ) { $ pdoCheck = $ this -> application -> make ( PdoMysqlExtension :: class ) -> performCheck ( ) ; if ( $ pdoCheck -> getState ( ) !== PreconditionResult :: STATE_PASSED ) { throw new UserMessageException ( $ pdoCheck -> getMessage ( ) ) ; } $ databaseConfiguration = $ this -> getDef...
Create a new Connection instance using the values specified in the options .
10,005
public function getStartingPoint ( $ fallbackToDefault ) { $ handle = $ this -> getOptions ( ) -> getStartingPointHandle ( ) ; if ( $ handle === '' ) { if ( ! $ fallbackToDefault ) { throw new UserMessageException ( t ( 'The starting point has not been defined.' ) ) ; } $ handle = static :: DEFAULT_STARTING_POINT ; } $...
Get the StartingPointPackage instance .
10,006
protected function getTranslationsStats ( Translations $ translations , DateTime $ defaultUpdatedOn ) { $ result = null ; foreach ( $ translations as $ translation ) { if ( $ translation -> hasTranslation ( ) ) { $ result = [ 'version' => '' , 'updatedOn' => $ defaultUpdatedOn , ] ; break ; } } if ( $ result !== null )...
Get stats for a \ Gettext \ Translations instance .
10,007
protected function getMoFileStats ( $ moFile ) { if ( $ this -> fs -> isFile ( $ moFile ) ) { $ lastModifiedTimestamp = $ this -> fs -> lastModified ( $ moFile ) ; if ( $ this -> cache -> isEnabled ( ) ) { $ cacheItem = $ this -> cache -> getItem ( self :: CACHE_PREFIX . '/' . md5 ( $ moFile ) . '_' . $ lastModifiedTim...
Get stats for a gettext . mo file .
10,008
public function get ( $ itemsToGet = 100 , $ offset = 0 ) { $ userInfos = array ( ) ; $ this -> createQuery ( ) ; $ r = parent :: get ( $ itemsToGet , intval ( $ offset ) ) ; foreach ( $ r as $ row ) { $ ui = UserInfo :: getByID ( $ row [ 'uID' ] ) ; $ userInfos [ ] = $ ui ; } return $ userInfos ; }
Returns an array of userInfo objects based on current filter settings .
10,009
public function getUserIDs ( $ itemsToGet = 100 , $ offset = 0 ) { $ this -> createQuery ( ) ; $ userIDs = array ( ) ; $ r = parent :: get ( $ itemsToGet , intval ( $ offset ) ) ; foreach ( $ r as $ row ) { $ userIDs [ ] = $ row [ 'uID' ] ; } return $ userIDs ; }
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,010
public function setIp ( $ ipAddress , $ isHex = false ) { if ( $ isHex ) { $ this -> ipHex = $ ipAddress ; } else { $ ipAddress = preg_replace ( '/\[(.*?)\].*/' , '$1' , $ ipAddress ) ; if ( strpos ( $ ipAddress , '.' ) !== false ) { $ ipAddress = preg_replace ( '/(.*?(?:\d{1,3}\.?){4}).*/' , "$1" , $ ipAddress ) ; } $...
Sets the current IP Address .
10,011
public function getIp ( $ format = self :: FORMAT_HEX ) { if ( $ this -> ipHex === null ) { return null ; } elseif ( $ format === self :: FORMAT_HEX ) { return $ this -> ipHex ; } elseif ( $ format === self :: FORMAT_IP_STRING ) { return inet_ntop ( $ this -> hex2bin ( $ this -> ipHex ) ) ; } throw new \ Exception ( 'I...
Returns the IPAddress string null if no ip address has been set .
10,012
public function isLoopBack ( ) { if ( ! $ this -> isIpSet ( ) ) { throw new \ Exception ( 'No IP Set' ) ; } if ( $ this -> isIPv4 ( ) && strpos ( $ this -> ipHex , '7f' ) === 0 ) { return true ; } elseif ( $ this -> ipHex === '00000000000000000000000000000001' || $ this -> ipHex === '00000000000000000000ffff7f000001' )...
Used to check of the current IP is a loopback IP address .
10,013
public function isPrivate ( ) { if ( ! $ this -> isIpSet ( ) ) { throw new \ Exception ( 'No IP Set' ) ; } if ( ( $ this -> isIPv4 ( ) && ( strpos ( $ this -> ipHex , '0a' ) === 0 || strpos ( $ this -> ipHex , 'ac1' ) === 0 || strpos ( $ this -> ipHex , 'c0a8' ) === 0 ) ) || ( $ this -> isIPv6 ( ) && ( strpos ( $ this ...
Returns true if the IP address belongs to a private network false if it is not .
10,014
public function getWorkflowProgressCurrentStatusNum ( WorkflowProgress $ wp ) { $ req = $ wp -> getWorkflowRequestObject ( ) ; if ( is_object ( $ req ) ) { return $ req -> getWorkflowRequestStatusNum ( ) ; } }
we do this so that we can order things by most important etc ...
10,015
public function before ( DateTime $ before , $ user = null , $ count = false ) { $ before = $ this -> validateTimezone ( $ before ) ; $ user = $ this -> validateUser ( $ user ) ; $ qb = $ this -> createQueryBuilder ( 'a' ) ; if ( $ count ) { $ qb -> select ( 'count(a)' ) ; } else { $ qb -> select ( ) ; } $ qb -> where ...
Get a list of login attempts prior to a date
10,016
private function validateUser ( $ user , $ requireValue = false ) { if ( ! $ user && ! $ requireValue ) { return null ; } if ( $ user instanceof User || $ user instanceof UserInfo ) { return ( int ) $ user -> getUserID ( ) ; } if ( is_numeric ( $ user ) ) { return ( int ) $ user ; } throw new \ InvalidArgumentException...
Validate a passed user value and resolve the ID
10,017
public function persistNewAuthCode ( AuthCodeEntityInterface $ authCodeEntity ) { $ this -> getEntityManager ( ) -> transactional ( function ( EntityManagerInterface $ entityManager ) use ( $ authCodeEntity ) { $ entityManager -> persist ( $ authCodeEntity ) ; } ) ; }
Persists a new auth code to permanent storage .
10,018
public function revokeAuthCode ( $ codeId ) { $ code = $ this -> find ( $ codeId ) ; if ( ! $ code ) { throw new \ InvalidArgumentException ( 'Invalid auth token code' ) ; } $ this -> getEntityManager ( ) -> transactional ( function ( EntityManagerInterface $ em ) use ( $ code ) { $ code = $ em -> merge ( $ code ) ; if...
Revoke an auth code .
10,019
public function getItemsPerPage ( ) { $ query = $ this -> getSessionCurrentQuery ( ) ; if ( $ query ) { return $ query -> getItemsPerPage ( ) ; } else { return $ this -> entity -> getItemsPerPage ( ) ; } }
Returns the number of items per page .
10,020
protected function getQueueId ( $ name ) { $ r = $ this -> db -> fetchColumn ( 'select queue_id from Queues where queue_name = ? limit 1' , [ $ name ] ) ; if ( $ r === false ) { throw new RuntimeException ( t ( 'Queue does not exist: %s' , $ name ) ) ; } $ count = ( int ) $ r ; return $ count ; }
Get the identifier of a queue given its name .
10,021
public static function encodePath ( $ path ) { if ( mb_strpos ( $ path , '/' ) !== false ) { $ path = explode ( '/' , $ path ) ; $ path = array_map ( 'rawurlencode' , $ path ) ; $ newPath = implode ( '/' , $ path ) ; } else { if ( is_null ( $ path ) ) { $ newPath = null ; } else { $ newPath = rawurlencode ( $ path ) ; ...
URL - encodes collection path .
10,022
public function slugSafeString ( $ handle , $ maxlength = 128 ) { $ handle = preg_replace ( '/[^\\p{L}\\p{Nd}\-_]+/u' , ' ' , $ handle ) ; $ handle = preg_replace ( '/[-\s]+/' , '-' , $ handle ) ; return trim ( Utf8 :: substr ( $ handle , 0 , $ maxlength ) , '-' ) ; }
Remove unsafe characters for URL slug .
10,023
public function sanitize ( $ string , $ max_length = 0 , $ allowed = '' ) { $ text = trim ( strip_tags ( $ string , $ allowed ) ) ; if ( $ max_length > 0 ) { if ( function_exists ( 'mb_substr' ) ) { $ text = mb_substr ( $ text , 0 , $ max_length , APP_CHARSET ) ; } else { $ text = substr ( $ text , 0 , $ max_length ) ;...
Strips tags and optionally reduces string to specified length .
10,024
public function makenice ( $ input ) { $ output = strip_tags ( $ input ) ; $ output = $ this -> autolink ( $ output ) ; $ output = nl2br ( $ output ) ; return $ output ; }
Runs a number of text functions including autolink nl2br strip_tags . Assumes that you want simple text comments but with a few niceties .
10,025
public function autolink ( $ input , $ newWindow = false , $ defaultProtocol = 'http://' ) { $ target = $ newWindow ? ' target="_blank"' : '' ; $ output = preg_replace_callback ( '/(http:\/\/|https:\/\/|(www\.))(([^\s<]{4,80})[^\s<]*)/' , function ( array $ matches ) use ( $ target , $ defaultProtocol ) { $ protocol = ...
Scans passed text and automatically hyperlinks any URL inside it .
10,026
public function handle ( $ handle , $ leaveSlashes = false ) { $ handle = $ this -> sanitizeFileSystem ( $ handle , $ leaveSlashes ) ; return str_replace ( '-' , '_' , $ handle ) ; }
Takes a string and turns it into a handle .
10,027
public function urlify ( $ handle , $ max_length = null , $ locale = '' , $ removeExcludedWords = true ) { if ( $ max_length === null ) { $ max_length = Config :: get ( 'concrete.seo.segment_max_length' ) ; } $ text = strtolower ( str_replace ( array ( "\r" , "\n" , "\t" ) , ' ' , $ this -> asciify ( $ handle , $ local...
Takes text and returns it in the lowercase - and - dashed - with - no - punctuation format .
10,028
public function highlightSearch ( $ value , $ searchString ) { if ( strlen ( $ value ) < 1 || strlen ( $ searchString ) < 1 ) { return $ value ; } preg_match_all ( "/$searchString+/i" , $ value , $ matches ) ; if ( is_array ( $ matches [ 0 ] ) && count ( $ matches [ 0 ] ) > 0 ) { return str_replace ( $ matches [ 0 ] [ ...
Highlights a string within a string with the class ccm - highlight - search .
10,029
public function appendXML ( \ SimpleXMLElement $ root , \ SimpleXMLElement $ new ) { $ node = $ root -> addChild ( $ new -> getName ( ) , ( string ) $ new ) ; foreach ( $ new -> attributes ( ) as $ attr => $ value ) { $ node -> addAttribute ( $ attr , $ value ) ; } foreach ( $ new -> children ( ) as $ ch ) { $ this -> ...
Appends a SimpleXMLElement to a SimpleXMLElement .
10,030
public function submit ( $ text , $ formID = false , $ buttonAlign = 'right' , $ innerClass = null , $ args = [ ] ) { if ( 'right' == $ buttonAlign ) { $ innerClass .= ' pull-right' ; } elseif ( 'left' == $ buttonAlign ) { $ innerClass .= ' pull-left' ; } if ( ! $ formID ) { $ formID = 'button' ; } $ argsstr = '' ; for...
Generates a submit button in the Concrete style .
10,031
public function button ( $ text , $ href , $ buttonAlign = 'right' , $ innerClass = null , $ args = [ ] ) { if ( 'right' == $ buttonAlign ) { $ innerClass .= ' pull-right' ; } elseif ( 'left' == $ buttonAlign ) { $ innerClass .= ' pull-left' ; } $ argsstr = '' ; foreach ( $ args as $ k => $ v ) { $ argsstr .= $ k . '="...
Generates a simple link button in the Concrete style .
10,032
public function buttonJs ( $ text , $ onclick , $ buttonAlign = 'right' , $ innerClass = null , $ args = [ ] ) { if ( 'right' == $ buttonAlign ) { $ innerClass .= ' pull-right' ; } elseif ( 'left' == $ buttonAlign ) { $ innerClass .= ' pull-left' ; } $ argsstr = '' ; foreach ( $ args as $ k => $ v ) { $ argsstr .= $ k ...
Generates a JavaScript function button in the Concrete style .
10,033
public function showHelpOverlay ( ) { $ result = false ; if ( Config :: get ( 'concrete.misc.help_overlay' ) ) { $ u = new ConcreteUser ( ) ; $ timestamp = $ u -> config ( 'MAIN_HELP_LAST_VIEWED' ) ; if ( ! $ timestamp ) { $ result = true ; } } return $ result ; }
Shall we show the introductive help overlay?
10,034
public function getProcessedBody ( ) { $ r = preg_split ( MailImporter :: getMessageBodyHashRegularExpression ( ) , $ this -> body ) ; $ message = $ r [ 0 ] ; $ r = preg_replace ( array ( '/^On (.*) at (.*), (.*) wrote:/sm' , '/[\n\r\s\>]*\Z/i' , ) , '' , $ message ) ; return $ r ; }
Returns the relevant content of the email message minus any quotations and the line that includes the validation hash .
10,035
public function validate ( ) { if ( ! $ this -> validationHash ) { return false ; } $ db = Database :: connection ( ) ; $ row = $ db -> GetRow ( "select * from MailValidationHashes where mHash = ? order by mDateGenerated desc limit 1" , $ this -> validationHash ) ; if ( $ row [ 'mvhID' ] > 0 ) { return $ row [ 'mDateRe...
Validates the email message - checks the validation hash found in the body with one in the database . Checks the from address as well .
10,036
public function isSendError ( ) { $ message = $ this -> getOriginalMessageObject ( ) ; $ headers = $ message -> getHeaders ( ) ; $ isSendError = false ; if ( is_array ( $ headers ) && count ( $ headers ) ) { foreach ( array_keys ( $ headers ) as $ key ) { if ( strstr ( $ key , 'x-fail' ) !== false ) { $ isSendError = t...
checks to see if the message is a bounce or delivery failure .
10,037
protected function getLoggedInUser ( ) { if ( ! $ this -> user ) { $ this -> user = $ this -> app -> make ( User :: class ) ; } return $ this -> user ; }
Resolve a user intance from the IOC container and cache it
10,038
public static function loadAll ( ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ permissionkeys = [ ] ; $ txt = $ app -> make ( 'helper/text' ) ; $ e = $ db -> executeQuery ( <<<'EOT'select pkID, pkName, pkDescription, pkHandle, pkCategoryHandle, pkCanTriggerWorkfl...
Get the list of all the defined permission keys .
10,039
public function getPackageHandle ( ) { $ pkgID = $ this -> getPackageID ( ) ; return $ pkgID ? PackageList :: getHandle ( $ this -> pkgID ) : null ; }
Get the handle of the package that defines this permission key .
10,040
public static function getList ( $ pkCategoryHandle , $ filters = [ ] ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ q = 'select pkID from PermissionKeys inner join PermissionKeyCategories on PermissionKeys.pkCategoryID = PermissionKeyCategories.pkCategoryID where...
Returns the list of all permissions of this category .
10,041
public function export ( $ axml ) { $ category = PermissionKeyCategory :: getByID ( $ this -> pkCategoryID ) -> getPermissionKeyCategoryHandle ( ) ; $ pkey = $ axml -> addChild ( 'permissionkey' ) ; $ pkey -> addAttribute ( 'handle' , $ this -> getPermissionKeyHandle ( ) ) ; $ pkey -> addAttribute ( 'name' , $ this -> ...
Export this permission key to a SimpleXMLElement instance .
10,042
public static function exportList ( $ xml ) { $ categories = PermissionKeyCategory :: getList ( ) ; $ pxml = $ xml -> addChild ( 'permissionkeys' ) ; foreach ( $ categories as $ cat ) { $ permissions = static :: getList ( $ cat -> getPermissionKeyCategoryHandle ( ) ) ; foreach ( $ permissions as $ p ) { $ p -> export (...
Export the list of all permissions of this category to a SimpleXMLElement instance .
10,043
public static function getListByPackage ( $ pkg ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ kina = [ '-1' ] ; $ rs = $ db -> executeQuery ( 'select pkCategoryID from PermissionKeyCategories where pkgID = ?' , [ $ pkg -> getPackageID ( ) ] ) ; while ( ( $ pkCate...
Get the list of permission keys defined by a package . Note this queries both the pkgID found on the PermissionKeys table AND any permission keys of a special type installed by that package and any in categories by that package .
10,044
public static function import ( SimpleXMLElement $ pk ) { if ( $ pk [ 'package' ] ) { $ app = Application :: getFacadeApplication ( ) ; $ pkg = $ app -> make ( PackageService :: class ) -> getByHandle ( $ pk [ 'package' ] ) ; } else { $ pkg = null ; } return self :: add ( $ pk [ 'category' ] , $ pk [ 'handle' ] , $ pk ...
Import a permission key from a SimpleXMLElement element .
10,045
public static function getByID ( $ pkID ) { $ keys = null ; $ app = Application :: getFacadeApplication ( ) ; $ cache = $ app -> make ( 'cache/request' ) ; if ( $ cache -> isEnabled ( ) ) { $ item = $ cache -> getItem ( 'permission_keys' ) ; if ( ! $ item -> isMiss ( ) ) { $ keys = $ item -> get ( ) ; } } if ( $ keys =...
Get a permission key given its ID .
10,046
public static function getByHandle ( $ pkHandle ) { $ keys = null ; $ app = Application :: getFacadeApplication ( ) ; $ cache = $ app -> make ( 'cache/request' ) ; if ( $ cache -> isEnabled ( ) ) { $ item = $ cache -> getItem ( 'permission_keys' ) ; if ( ! $ item -> isMiss ( ) ) { $ keys = $ item -> get ( ) ; } } if ( ...
Get a permission key given its handle .
10,047
public static function add ( $ pkCategoryHandle , $ pkHandle , $ pkName , $ pkDescription , $ pkCanTriggerWorkflow , $ pkHasCustomClass , $ pkg = false ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ pkCategoryID = $ db -> fetchColumn ( 'select pkCategoryID from Pe...
Adds an permission key .
10,048
public function delete ( ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ db -> executeQuery ( 'delete from PermissionKeys where pkID = ?' , [ $ this -> getPermissionKeyID ( ) ] ) ; self :: loadAll ( ) ; }
Delete this permission key .
10,049
public function getAccessListItems ( ) { $ obj = $ this -> getPermissionAccessObject ( ) ; if ( ! $ obj ) { return [ ] ; } $ args = func_get_args ( ) ; switch ( count ( $ args ) ) { case 0 : return $ obj -> getAccessListItems ( ) ; case 1 : return $ obj -> getAccessListItems ( $ args [ 0 ] ) ; case 2 : return $ obj -> ...
A shortcut for grabbing the current assignment and passing into that object .
10,050
public static function exportTranslations ( ) { $ translations = new Translations ( ) ; $ categories = PermissionKeyCategory :: getList ( ) ; foreach ( $ categories as $ cat ) { $ permissions = static :: getList ( $ cat -> getPermissionKeyCategoryHandle ( ) ) ; foreach ( $ permissions as $ p ) { $ translations -> inser...
Export the strings that should be translated .
10,051
public function boot ( ) { $ booter = $ this -> getBooter ( ) ; if ( $ response = $ booter -> boot ( ) ) { $ this -> sendResponse ( $ response ) ; } else { $ this -> status = self :: STATUS_ACTIVE ; } }
Initialize the environment and prepare for running .
10,052
public function getService ( $ handle , $ version = '' ) { $ result = null ; if ( $ this -> has ( $ handle ) ) { $ key = $ handle ; $ version = ( string ) $ version ; if ( $ version !== '' ) { $ key .= "@$version" ; } if ( ! isset ( $ this -> services [ $ key ] ) ) { $ abstract = $ this -> extensions [ $ handle ] ; $ s...
Get the driver for this handle .
10,053
private function buildService ( $ abstract , $ version = '' ) { $ resolved = null ; if ( is_string ( $ abstract ) ) { $ resolved = $ this -> app -> make ( $ abstract , array ( $ version ) ) ; } elseif ( is_callable ( $ abstract ) ) { $ resolved = $ abstract ( $ version , $ this -> app , $ this ) ; } return $ resolved ;...
Build a service from an abstract .
10,054
public function getAllServices ( ) { $ result = array ( ) ; foreach ( $ this -> getExtensions ( ) as $ handle ) { $ result [ $ handle ] = $ this -> getService ( $ handle ) ; } return $ result ; }
Returns all the available services .
10,055
public function getActiveServices ( ) { $ active = array ( ) ; foreach ( $ this -> getExtensions ( ) as $ handle ) { $ service = $ this -> getService ( $ handle ) ; $ version = $ service -> getDetector ( ) -> detect ( ) ; if ( $ version !== null ) { $ active [ ] = $ this -> getService ( $ handle , $ version ) ; } } ret...
Loops through the bound services and returns the ones that are active .
10,056
protected function getEscapeMap ( ) { if ( $ this -> escapeMap === null ) { $ escapeMap = [ $ this -> anyCharacterWildcard => $ this -> escapeCharacter . $ this -> anyCharacterWildcard , $ this -> oneCharacterWildcard => $ this -> escapeCharacter . $ this -> oneCharacterWildcard , $ this -> escapeCharacter => $ this ->...
Get the string mapping used to escape special characters .
10,057
public function escapeForLike ( $ string , $ wildcardAtStart = true , $ wildcardAtEnd = true ) { if ( $ wildcardAtStart ) { $ result = $ this -> anyCharacterWildcard ; } else { $ result = '' ; } $ result .= strtr ( ( string ) $ string , $ this -> getEscapeMap ( ) ) ; if ( $ wildcardAtEnd && $ result !== $ this -> anyCh...
Escape a string to be safely used as a parameter for a LIKE query .
10,058
public function splitKeywordsForLike ( $ string , $ wordSeparators = '\s' , $ addWildcards = true ) { $ result = null ; if ( is_string ( $ string ) ) { $ words = preg_split ( '/[' . $ wordSeparators . ']+/ms' , $ string ) ; foreach ( $ words as $ word ) { if ( $ word !== '' ) { $ result [ ] = $ this -> escapeForLike ( ...
Split a string into words and format them to be used in LIKE queries .
10,059
private function returnThumbnailObjectFromResolver ( $ obj , $ maxWidth , $ maxHeight , $ crop = false ) { return $ this -> processThumbnail ( true , $ obj , $ maxWidth , $ maxHeight , $ crop ) ; }
Checks thumbnail resolver for filename schedule for creation via ajax if necessary .
10,060
private function checkForThumbnailAndCreateIfNecessary ( $ obj , $ maxWidth , $ maxHeight , $ crop = false ) { return $ this -> processThumbnail ( false , $ obj , $ maxWidth , $ maxHeight , $ crop ) ; }
Checks filesystem for thumbnail and if file doesn t exist will create it immediately . concrete5 s default behavior from the beginning up to 8 . 1 .
10,061
public function getResults ( ) { $ results = array ( ) ; $ this -> debugStart ( ) ; $ executeResults = $ this -> executeGetResults ( ) ; $ this -> debugStop ( ) ; foreach ( $ executeResults as $ result ) { $ r = $ this -> getResult ( $ result ) ; if ( $ r != null ) { $ results [ ] = $ r ; } } return $ results ; }
Returns a full array of results .
10,062
public function setNameSpace ( $ nameSpace ) { $ this -> paginationPageParameter .= '_' . $ nameSpace ; $ this -> sortColumnParameter .= '_' . $ nameSpace ; $ this -> sortDirectionParameter .= '_' . $ nameSpace ; }
Allow to modify the auto - pagination parameters and the auto - sorting parameters
10,063
public function describeVar ( $ name , $ value ) { return $ this -> indentation . '/** @var ' . $ this -> getVarType ( $ value ) . ' ' . ( $ name [ 0 ] === '$' ? '' : '$' ) . $ name . " */\n" ; }
Generate the PHPDoc to describe a variable .
10,064
public function describeVars ( array $ vars , $ sortByName = true ) { $ result = '' ; if ( $ sortByName ) { ksort ( $ vars , SORT_NATURAL ) ; } foreach ( $ vars as $ name => $ value ) { $ result .= $ this -> describeVar ( $ name , $ value ) ; } return $ result ; }
Generate the PHPDoc to describe a list of variables .
10,065
protected function getVarType ( $ var , $ arrayLevel = 0 ) { $ phpType = gettype ( $ var ) ; switch ( $ phpType ) { case 'boolean' : $ result = 'bool' ; break ; case 'integer' : $ result = 'int' ; break ; case 'double' : $ result = 'float' ; break ; case 'string' : $ result = 'string' ; break ; case 'array' : if ( $ ar...
Get the PHPDoc type name of a variable .
10,066
public static function getByHandle ( $ handle ) { $ list = Type :: getVersionList ( ) ; foreach ( $ list as $ version ) { if ( $ version -> getHandle ( ) == $ handle ) { return $ version ; } } }
Get a thumbnail type version given its handle .
10,067
public function shouldExistFor ( $ imageWidth , $ imageHeight , File $ file = null ) { $ result = false ; $ imageWidth = ( int ) $ imageWidth ; $ imageHeight = ( int ) $ imageHeight ; if ( $ imageWidth > 0 && $ imageHeight > 0 ) { $ thumbnailWidth = ( int ) $ this -> getWidth ( ) ? : 0 ; $ thumbnailHeight = ( int ) $ t...
Check if this thumbnail type version should exist for an image with the specified dimensions .
10,068
public function getCountries ( ) { if ( ! array_key_exists ( Localization :: activeLocale ( ) , $ this -> countries ) ) { $ this -> loadCountries ( ) ; } return $ this -> countries [ Localization :: activeLocale ( ) ] ; }
Returns an array of countries with their short name as the key and their full name as the value
10,069
public function getCountriesForLanguage ( $ languageCode , $ languageStatuses = 'orfm' ) { $ territories = [ ] ; foreach ( \ Punic \ Territory :: getTerritoriesForLanguage ( $ languageCode ) as $ territory ) { $ territoryLanguages = \ Punic \ Territory :: getLanguages ( $ territory , $ languageStatuses , true ) ; if ( ...
Return a list of territory codes where a specific language is spoken sorted by the total number of people speaking that language .
10,070
protected function validateAction ( ) { $ token = ( isset ( $ this -> validationToken ) ) ? $ this -> validationToken : get_class ( $ this ) ; if ( ! $ this -> app -> make ( 'token' ) -> validate ( $ token ) ) { $ this -> error -> add ( $ this -> app -> make ( 'token' ) -> getErrorMessage ( ) ) ; return false ; } if ( ...
Check whether the token is valid and if the current page be accessed .
10,071
private function resolveRoute ( $ route_handle , $ route_parameters ) { $ list = $ this -> getRouteList ( ) ; $ generator = $ this -> getGenerator ( ) ; if ( $ route = $ list -> get ( $ route_handle ) ) { if ( $ path = $ generator -> generate ( $ route_handle , $ route_parameters , UrlGeneratorInterface :: ABSOLUTE_PAT...
Resolve the route .
10,072
public function setError ( $ code , $ message = '' , Exception $ innerException = null ) { if ( $ code == static :: ERR_NONE && ! $ message && $ innerException === null ) { $ this -> errorCode = static :: ERR_NONE ; $ this -> errorMessage = '' ; $ this -> innerException = null ; } else { $ code = ( int ) $ code ; $ thi...
Set the error state .
10,073
public function setLatitude ( $ value ) { if ( is_float ( $ value ) || is_int ( $ value ) || ( is_string ( $ value ) && is_numeric ( $ value ) ) ) { $ this -> latitude = ( float ) $ value ; } else { $ this -> latitude = null ; } return $ this ; }
Set the latitude .
10,074
public function setLongitude ( $ value ) { if ( is_float ( $ value ) || is_int ( $ value ) || ( is_string ( $ value ) && is_numeric ( $ value ) ) ) { $ this -> longitude = ( float ) $ value ; } else { $ this -> longitude = null ; } return $ this ; }
Set the longitude .
10,075
public function hasData ( ) { return $ this -> countryCode !== '' || $ this -> countryName !== '' || $ this -> stateProvinceCode !== '' || $ this -> stateProvinceName !== '' || $ this -> cityName !== '' || $ this -> postalCode !== '' || $ this -> latitude !== null || $ this -> longitude !== null ; }
Does this instance contain some geolocalized data?
10,076
protected function getDestinationFolder ( ) { if ( $ this -> destinationFolder === false ) { $ replacingFile = $ this -> getFileToBeReplaced ( ) ; if ( $ replacingFile !== null ) { $ folder = $ replacingFile -> getFileFolderObject ( ) ; } else { $ treeNodeID = $ this -> request -> request -> get ( 'currentFolder' ) ; i...
Get the destination folder where the uploaded files should be placed .
10,077
protected function downloadRemoteURL ( $ url , $ temporaryDirectory ) { $ client = $ this -> app -> make ( 'http/client' ) ; $ request = $ client -> getRequest ( ) -> setUri ( $ url ) ; $ response = $ client -> send ( ) ; if ( ! $ response -> isSuccess ( ) ) { throw new UserMessageException ( t ( 'There was an error do...
Download an URL to the temporary directory .
10,078
public function shouldEnableLegacyNamespace ( ) { if ( isset ( $ this -> pkgAutoloaderMapCoreExtensions ) && $ this -> pkgAutoloaderMapCoreExtensions ) { return false ; } $ concrete5 = '7.9.9' ; $ package = $ this -> getApplicationVersionRequired ( ) ; if ( version_compare ( $ package , $ concrete5 , '>' ) ) { return f...
Should this package enable legacy namespaces?
10,079
public function getDatabaseConfig ( ) { if ( ! $ this -> config ) { $ this -> config = new Liaison ( $ this -> app -> make ( 'config/database' ) , $ this -> getPackageHandle ( ) ) ; } return $ this -> config ; }
Get the database configuration liaison .
10,080
public function getFileConfig ( ) { if ( ! $ this -> fileConfig ) { $ this -> fileConfig = new Liaison ( $ this -> app -> make ( 'config' ) , $ this -> getPackageHandle ( ) ) ; } return $ this -> fileConfig ; }
Get the filesystem configuration liaison .
10,081
public function getPackagePath ( ) { $ packageHandle = $ this -> getPackageHandle ( ) ; $ result = $ this -> DIR_PACKAGES . '/' . $ packageHandle ; if ( ! is_dir ( $ result ) ) { $ result = $ this -> DIR_PACKAGES_CORE . '/' . $ packageHandle ; } return $ result ; }
Get the absolute path to the package .
10,082
public function getRelativePath ( ) { $ packageHandle = $ this -> getPackageHandle ( ) ; if ( is_dir ( $ this -> DIR_PACKAGES . '/' . $ packageHandle ) ) { $ result = $ this -> REL_DIR_PACKAGES . '/' . $ packageHandle ; } else { $ result = $ this -> REL_DIR_PACKAGES_CORE . '/' . $ packageHandle ; } return $ result ; }
Get the path to the package relative to the web root .
10,083
public function getChangelogContents ( ) { $ prefix = $ this -> getPackagePath ( ) . '/' ; foreach ( [ 'CHANGELOG' , 'CHANGELOG.txt' , 'CHANGELOG.md' ] as $ name ) { $ file = $ prefix . $ name ; if ( is_file ( $ file ) ) { $ contents = $ this -> app -> make ( 'helper/file' ) -> getContents ( $ file ) ; return nl2br ( h...
Get the contents of the package s CHANGELOG file .
10,084
public function backup ( ) { $ packageHandle = $ this -> getPackageHandle ( ) ; $ errors = $ this -> app -> make ( 'error' ) ; if ( $ packageHandle === '' || ! is_dir ( DIR_PACKAGES . '/' . $ packageHandle ) ) { $ errors -> add ( $ this -> getErrorText ( self :: E_PACKAGE_NOT_FOUND ) ) ; } else { $ config = $ this -> a...
Move the current package directory to the trash directory and rename it with the package handle and a date code .
10,085
public static function installDB ( $ xmlFile ) { if ( file_exists ( $ xmlFile ) ) { $ app = ApplicationFacade :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ db -> beginTransaction ( ) ; $ parser = Schema :: getSchemaParser ( simplexml_load_file ( $ xmlFile ) ) ; $ parser -> setIgnoreExis...
Installs a package database from an XML file .
10,086
public function upgradeCoreData ( ) { $ entity = $ this -> getPackageEntity ( ) ; if ( $ entity !== null ) { $ em = $ this -> app -> make ( EntityManagerInterface :: class ) ; $ entity -> setPackageName ( $ this -> getPackageName ( ) ) ; $ entity -> setPackageDescription ( $ this -> getPackageDescription ( ) ) ; $ enti...
Updates the package entity name description and version using the current class properties .
10,087
public function upgrade ( ) { $ this -> upgradeDatabase ( ) ; $ manager = new Manager ( $ this -> app ) ; $ items = $ manager -> driver ( 'block_type' ) -> getItems ( $ this -> getPackageEntity ( ) ) ; foreach ( $ items as $ item ) { $ item -> refresh ( ) ; } Localization :: clearCache ( ) ; }
Upgrades a package s database and refreshes all blocks .
10,088
public function upgradeDatabase ( ) { $ em = $ this -> getPackageEntityManager ( ) ; if ( $ em !== null ) { $ this -> destroyProxyClasses ( $ em ) ; $ this -> installEntitiesDatabase ( ) ; } static :: installDB ( $ this -> getPackagePath ( ) . '/' . FILENAME_PACKAGE_DB ) ; }
Updates a package s database using entities and a db . xml .
10,089
public function getPackageEntityManager ( ) { $ providerFactory = new PackageProviderFactory ( $ this -> app , $ this ) ; $ provider = $ providerFactory -> getEntityManagerProvider ( ) ; $ drivers = $ provider -> getDrivers ( ) ; if ( empty ( $ drivers ) ) { $ result = null ; } else { $ config = Setup :: createConfigur...
Create an entity manager used for the package install upgrade and unistall process .
10,090
protected function getErrorText ( $ errorCode ) { if ( is_array ( $ errorCode ) ) { $ code = array_shift ( $ errorCode ) ; $ result = vsprintf ( $ this -> getErrorText ( $ code ) , $ errorCode ) ; } else { $ config = $ this -> app -> make ( 'config' ) ; $ dictionary = [ self :: E_PACKAGE_INSTALLED => t ( "You've alread...
Get the error text corresponsing to an error code .
10,091
protected function destroyProxyClasses ( EntityManagerInterface $ em ) { $ config = $ em -> getConfiguration ( ) ; $ proxyGenerator = new ProxyGenerator ( $ config -> getProxyDir ( ) , $ config -> getProxyNamespace ( ) ) ; $ classes = $ em -> getMetadataFactory ( ) -> getAllMetadata ( ) ; foreach ( $ classes as $ class...
Destroys all proxies related to a package .
10,092
public function getByHandle ( $ akCategoryHandle ) { $ r = $ this -> entityManager -> getRepository ( Category :: class ) ; return $ r -> findOneBy ( [ 'akCategoryHandle' => $ akCategoryHandle ] ) ; }
Get a attribute category given its handle .
10,093
public function getByID ( $ akCategoryID ) { $ r = $ this -> entityManager -> getRepository ( Category :: class ) ; return $ r -> findOneBy ( [ 'akCategoryID' => $ akCategoryID ] ) ; }
Get a attribute category given its ID .
10,094
public function getListByPackage ( Package $ pkg ) { $ r = $ this -> entityManager -> getRepository ( Category :: class ) ; return $ r -> findByPackage ( $ pkg ) ; }
Get all the available attribute categories created by a package .
10,095
public function add ( $ akCategoryHandle , $ allowSets = StandardSetManager :: ASET_ALLOW_SINGLE , $ pkg = null ) { $ category = new Category ( ) ; $ category -> setAttributeKeyCategoryHandle ( $ akCategoryHandle ) ; $ category -> setAllowAttributeSets ( $ allowSets ) ; if ( $ pkg ) { $ category -> setPackage ( $ pkg )...
Create a new attribute category .
10,096
public static function getByID ( $ btsID ) { $ result = null ; $ btsID = ( int ) $ btsID ; if ( $ btsID !== 0 ) { $ app = Application :: getFacadeApplication ( ) ; $ cache = $ app -> make ( 'cache/request' ) ; $ identifier = sprintf ( 'block/type/set/%s' , $ btsID ) ; $ item = $ cache -> getItem ( $ identifier ) ; if (...
Get a block type set given its ID .
10,097
public static function getByHandle ( $ btsHandle ) { $ result = null ; $ btsHandle = ( string ) $ btsHandle ; if ( $ btsHandle !== '' ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ row = $ db -> fetchAssoc ( 'select btsID, btsHandle, pkgID, btsName from BlockTypeS...
Get a block type set given its handle .
10,098
public static function getListByPackage ( $ pkg ) { $ result = [ ] ; $ pkgID = ( int ) ( is_object ( $ pkg ) ? $ pkg -> getPackageID ( ) : $ pkg ) ; if ( $ pkgID !== 0 ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ rs = $ db -> executeQuery ( 'select btsID from Bl...
Get the list of block type sets defined by a package .
10,099
public static function getList ( $ excluded = [ 'core_desktop' ] ) { $ result = [ ] ; $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; if ( empty ( $ excluded ) ) { $ rs = $ db -> executeQuery ( 'select btsID from BlockTypeSets order by btsDisplayOrder asc' ) ; } else { $...
Get the list of block type sets .