idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
31,200 | private function registerDirectives ( ) { $ this -> register ( Not :: class ) ; $ this -> register ( EndEmpty :: class ) ; $ this -> register ( EndIsset :: class ) ; $ this -> register ( EndNot :: class ) ; $ this -> register ( EndNull :: class ) ; return true ; } | Register custom directives |
31,201 | public function setViewsDirectory ( string $ directory ) { if ( ! is_dir ( $ directory ) ) return $ this -> exception ( 'Views directory "' . $ directory . '" does not exist.' ) ; $ this -> viewsDirectory = $ directory ; return $ this ; } | Set default views directory . |
31,202 | public function setViewsExtension ( string $ extension ) { if ( substr ( $ extension , 0 , 1 ) != '.' ) { $ this -> viewsExtension = '.' . $ extension ; return $ this ; } $ this -> viewsExtension = $ extension ; return $ this ; } | Set default caching directory . |
31,203 | public function send ( ParsedMessage $ parsedMessage , \ Closure $ messageModifier = null ) { $ message = $ this -> transformMessage ( $ parsedMessage ) ; if ( null !== $ messageModifier ) { $ messageModifier ( $ message ) ; } $ this -> mailer -> send ( $ message ) ; } | Sends out a ParsedMessage |
31,204 | protected function transformMessage ( ParsedMessage $ parsedMessage ) { $ message = new \ Swift_Message ( ) ; if ( $ from = $ parsedMessage -> getFrom ( ) ) { $ message -> setFrom ( $ from ) ; } if ( $ to = $ parsedMessage -> getTo ( ) ) { $ message -> setTo ( $ to ) ; } if ( $ cc = $ parsedMessage -> getCc ( ) ) { $ message -> setCc ( $ cc ) ; } if ( $ bcc = $ parsedMessage -> getBcc ( ) ) { $ message -> setBcc ( $ bcc ) ; } if ( $ replyTo = $ parsedMessage -> getReplyTo ( ) ) { $ message -> setReplyTo ( $ replyTo ) ; } if ( $ subject = $ parsedMessage -> getSubject ( ) ) { $ message -> setSubject ( $ subject ) ; } $ message -> setBody ( $ parsedMessage -> getMessageText ( ) ) ; if ( $ parsedMessage -> getMessageHtml ( ) ) { $ message -> addPart ( $ parsedMessage -> getMessageHtml ( ) , 'text/html' ) ; } return $ message ; } | Creates a swift message from a ParsedMessage handles defaults |
31,205 | public function getListGroupEmail ( $ groupDn = null ) { $ result = [ ] ; if ( empty ( $ groupDn ) ) { return $ result ; } $ cacheKey = md5 ( $ groupDn ) ; $ cached = Cache :: read ( $ cacheKey , CAKE_SETTINGS_APP_CACHE_KEY_AD_GROUP_MEMBER_MAIL ) ; if ( ! empty ( $ cached ) ) { return $ cached ; } $ conditions = '(&(userAccountControl:1.2.840.113556.1.4.803:=512)(!(useraccountcontrol:1.2.840.113556.1.4.803:=2))(objectClass=user)(' . CAKE_SETTINGS_APP_LDAP_ATTRIBUTE_MEMBER_OF . '=' . $ groupDn . '))' ; $ fields = [ CAKE_SETTINGS_APP_LDAP_ATTRIBUTE_NAME , CAKE_SETTINGS_APP_LDAP_ATTRIBUTE_MAIL ] ; $ order = CAKE_SETTINGS_APP_LDAP_ATTRIBUTE_MAIL ; $ data = $ this -> find ( 'all' , compact ( 'conditions' , 'fields' , 'order' ) ) ; if ( empty ( $ data ) ) { return $ result ; } foreach ( $ data as $ dataItem ) { $ mail = Hash :: get ( $ dataItem , $ this -> alias . '.' . CAKE_SETTINGS_APP_LDAP_ATTRIBUTE_MAIL ) ; $ name = Hash :: get ( $ dataItem , $ this -> alias . '.' . CAKE_SETTINGS_APP_LDAP_ATTRIBUTE_NAME ) ; if ( empty ( $ mail ) ) { continue ; } $ result [ $ mail ] = $ name ; } Cache :: write ( $ cacheKey , $ result , CAKE_SETTINGS_APP_CACHE_KEY_AD_GROUP_MEMBER_MAIL ) ; return $ result ; } | Return list of e - mail for users that are members of a security group in Active Directory . |
31,206 | public function checkSearchBase ( $ userGuid = null , $ searchBase = null ) { if ( empty ( $ searchBase ) ) { return false ; } if ( empty ( $ userGuid ) ) { return $ this -> groupExists ( $ searchBase ) ; } $ prevUseTable = $ this -> useTable ; $ this -> useTable = $ searchBase ; $ conditions = [ CAKE_SETTINGS_APP_LDAP_ATTRIBUTE_OBJECT_GUID => GuidStringToLdap ( $ userGuid ) ] ; $ fields = [ CAKE_SETTINGS_APP_LDAP_ATTRIBUTE_DISTINGUISHED_NAME ] ; $ group = $ this -> find ( 'first' , compact ( 'conditions' , 'fields' ) ) ; $ this -> useTable = $ prevUseTable ; if ( empty ( $ group ) ) { return false ; } return true ; } | Check search base for user by GUID . |
31,207 | public function rememberTopLevelContainers ( ) { $ result = [ ] ; $ conditions = '(|(objectClass=organizationalUnit)(objectClass=container))' ; $ fields = [ CAKE_SETTINGS_APP_LDAP_ATTRIBUTE_DISTINGUISHED_NAME ] ; $ order = CAKE_SETTINGS_APP_LDAP_ATTRIBUTE_DISTINGUISHED_NAME ; $ limit = CAKE_SETTINGS_APP_TOP_LEVEL_UNITS_LIST_LIMIT ; $ scope = 'one' ; $ data = $ this -> find ( 'all' , compact ( 'conditions' , 'fields' , 'order' , 'limit' , 'scope' ) ) ; if ( empty ( $ data ) ) { return $ result ; } $ result = Hash :: extract ( $ data , '{n}.' . $ this -> alias . '.' . CAKE_SETTINGS_APP_LDAP_ATTRIBUTE_DISTINGUISHED_NAME ) ; return $ result ; } | Return list of top level containers from AD |
31,208 | public function convert ( \ Exception $ ex ) { $ exceptions = array ( ) ; do { $ exceptions [ ] = $ this -> convertException ( $ ex ) ; } while ( null !== $ ex = $ ex -> getPrevious ( ) ) ; return $ exceptions ; } | Converts an exception to an array . |
31,209 | public function formatTableName ( $ params ) { $ params = trim ( $ params ) ; if ( strpos ( $ params , ',' ) !== false ) { $ tables = explode ( ',' , $ params ) ; foreach ( $ tables as $ k => $ v ) { $ tables [ $ k ] = $ this -> formatTableName ( $ v ) ; } $ params = implode ( ',' , $ tables ) ; } elseif ( preg_match ( '/(\s(as\s)?)/i' , $ params , $ matches ) ) { $ arr = explode ( $ matches [ 1 ] , $ params , 2 ) ; $ params = $ this -> formatTableName ( $ arr [ 0 ] ) . $ matches [ 1 ] . $ arr [ 1 ] ; unset ( $ arr , $ matches ) ; } else { $ params = str_replace ( '#' , '.' , $ params ) ; $ pos = strpos ( $ params , '.' ) ; if ( $ pos === 0 ) { return ltrim ( $ params , '.' ) ; } elseif ( $ pos === false && ( isset ( $ this -> query [ 'table_prefix' ] [ 0 ] ) || isset ( $ this -> query [ 'database' ] [ 0 ] ) ) ) { $ table_prefix = isset ( $ this -> query [ 'table_prefix' ] [ 0 ] ) ? $ this -> query [ 'table_prefix' ] [ 0 ] : '' ; $ database = isset ( $ this -> query [ 'database' ] [ 0 ] ) ? $ this -> query [ 'database' ] [ 0 ] . '.' : '' ; if ( $ table_prefix && ! StringHelper :: startsWith ( $ params , $ table_prefix , false ) ) { $ params = $ this -> formatKey ( $ table_prefix . $ params ) ; } $ params = $ this -> formatKey ( $ database ) . $ params ; } } return $ params ; } | format table add dbname and table_prefix instead of db |
31,210 | protected function beforeParse ( ) { if ( isset ( $ this -> query [ 'table' ] ) ) { $ tables_str = implode ( ',' , $ this -> query [ 'table' ] ) ; if ( preg_match ( '/((?:as|\,|join)\w+)/i' , $ tables_str ) > 0 ) { $ this -> query -> hasAlias ( true ) ; } } } | handle somethind before parse common handle for every query |
31,211 | protected function _parseDataToTable ( $ data ) { $ values = array ( ) ; if ( is_scalar ( $ data ) ) { preg_match ( '/(.*)(\,|left\sjoin|inner\sjoin)+(.*)/i' , $ data , $ matches ) ; if ( $ matches ) { $ temp1 = $ this -> _parseDataToTable ( $ matches [ 1 ] ) ; $ temp2 = $ this -> _parseDataToTable ( $ matches [ 3 ] ) ; $ values [ ] = $ temp1 [ 0 ] . ' ' . $ matches [ 2 ] . ' ' . $ temp2 [ 0 ] ; } else { $ values [ ] = $ this -> formatTableName ( $ data ) ; } } elseif ( is_array ( $ data ) ) { foreach ( $ data as $ key => $ value ) { if ( ( is_numeric ( $ key ) || empty ( $ key ) ) && $ value ) { $ temp = $ this -> _parseDataToTable ( $ value ) ; $ values = array_merge ( $ values , $ temp ) ; } } } return $ values ; } | table use parse to from|update|delete|other table name |
31,212 | public function inflect ( $ command , $ commandHandler ) { $ commandName = get_class ( $ command ) ; $ start = strpos ( $ commandName , '\\' ) !== false ? strrpos ( $ commandName , '\\' ) + 1 : 0 ; $ length = strpos ( $ commandName , $ this -> suffix , - $ this -> suffixLength ) !== false ? $ this -> suffixLength : null ; return lcfirst ( $ length ? substr ( $ commandName , $ start , - $ length ) : substr ( $ commandName , $ start ) ) ; } | Return the method name to call on the command handler and return it . |
31,213 | private function getWidgetLocalClass ( string $ widgetType ) : AbstractWidget { if ( ! in_array ( $ widgetType , array_keys ( self :: $ widgetsMap ) , true ) ) { throw new Exception ( sprintf ( "Unknown Widget Type : %s" , $ widgetType ) ) ; } $ className = static :: $ widgetsMap [ $ widgetType ] ; if ( true !== $ this -> isValidWidgetClass ( $ className ) ) { throw new Exception ( $ this -> isValidWidgetClass ( $ className ) ) ; } $ genericWidget = new $ className ( $ this ) ; if ( is_subclass_of ( $ className , AbstractStandaloneWidget :: class ) ) { $ genericWidget -> configure ( $ widgetType , $ this -> getWebserviceId ( ) , $ this -> getConfiguration ( ) ) ; } return $ genericWidget ; } | Return a New Intance of Requested Widget Type Class |
31,214 | private function isValidWidgetClass ( $ className ) { if ( ! is_string ( $ className ) ) { return "Widget Type is Not a String" ; } if ( ! class_exists ( $ className ) ) { return "Widget Class Not Found" ; } if ( ! is_subclass_of ( $ className , AbstractWidget :: class ) ) { return "Widget Class MUST extends " . AbstractWidget :: class ; } return true ; } | Validate Widget Class Name |
31,215 | public function setAsset ( $ url , $ fileType ) { $ this -> assetUrl = $ url ; $ this -> assetFileType = $ fileType ; return $ this ; } | Set a content url for rich notifications . |
31,216 | protected function getBucket ( ) { $ bucketName = $ this -> attachedFile -> bucket ; if ( ! $ this -> bucketExists ) { $ this -> buildBucket ( $ bucketName ) ; } return $ bucketName ; } | This is a wrapper method for returning the name of an attachment s bucket . If the bucket doesn t exist we ll build it first before returning it s name . |
31,217 | public function create ( $ key , $ value , $ lifetime = null , $ scope = null ) { if ( $ scope === null ) { $ scope = $ this -> getScope ( ) ; } if ( $ lifetime === null ) { $ lifetime = $ this -> getGcMaximumLifetime ( ) ; } if ( $ this -> createExtended ( $ key , $ value , $ lifetime , $ scope ) === false ) { throw new Doozr_Cache_Service_Exception ( sprintf ( 'Error while creating entry with key: "%s" in scope: "%s"!' , $ key , $ scope ) ) ; } return true ; } | Creates an cache entry . |
31,218 | public function read ( $ key , $ scope = null , $ metaData = false ) { $ result = null ; if ( null === $ scope ) { $ scope = $ this -> getScope ( ) ; } if ( true !== $ this -> exists ( $ key , $ scope ) ) { throw new Doozr_Cache_Service_Exception ( sprintf ( 'Requested entry with key: "%s" in scope: "%s" could not be found in cache!' , $ key , $ scope ) ) ; } if ( false === $ this -> expired ( $ key , $ scope ) ) { $ result = $ this -> getContainer ( ) -> read ( $ key , $ scope ) ; } return ( true === $ metaData ) ? $ result : $ result [ 2 ] ; } | Returns the requested dataset it if exists and is not expired . |
31,219 | public function update ( $ key , $ value , $ lifetime = null , $ scope = null ) { if ( $ scope === null ) { $ scope = $ this -> getScope ( ) ; } return $ this -> create ( $ key , $ value , $ lifetime , $ scope ) ; } | Updates an entry . |
31,220 | public function exists ( $ key , $ scope = null ) { if ( $ scope === null ) { $ scope = $ this -> getScope ( ) ; } return $ this -> getContainer ( ) -> exists ( $ key , $ scope ) ; } | Checks if an cached object exists and return result . |
31,221 | public function expired ( $ key , $ scope = null , $ lifetime = null ) { if ( $ scope === null ) { $ scope = $ this -> getScope ( ) ; } if ( $ lifetime === null ) { $ lifetime = $ this -> getGcMaximumLifetime ( ) ; } return $ this -> getContainer ( ) -> expired ( $ key , $ scope , $ lifetime ) ; } | Checks whether an entry is expired . |
31,222 | public function garbageCollection ( $ scope = null , $ maximumLifetime = null , $ force = false ) { $ result = 0 ; if ( $ scope === null ) { $ scope = $ this -> getScope ( ) ; } if ( $ maximumLifetime === null ) { $ maximumLifetime = $ this -> getGcMaximumLifetime ( ) ; } srand ( microtime ( true ) ) ; if ( ( $ force ) || ( self :: $ gcLastRunTimestamp !== null && self :: $ gcLastRunTimestamp < ( time ( ) + $ this -> getGcProbabilityTime ( ) ) ) || ( rand ( 1 , 100 ) <= $ this -> gcProbability ) ) { $ result = $ this -> getContainer ( ) -> garbageCollection ( $ scope , $ maximumLifetime ) ; self :: $ gcLastRunTimestamp = time ( ) ; } return $ result ; } | Calls the garbage - collector of the cache - container . |
31,223 | public function purge ( $ scope = null ) { if ( null === $ scope ) { $ scope = $ this -> getScope ( ) ; } return $ this -> getContainer ( ) -> purge ( $ scope ) ; } | Removes all scope datasets from cache . |
31,224 | public function containerExists ( $ container ) { $ container = ucfirst ( strtolower ( $ container ) ) ; $ filename = $ this -> retrievePathToCurrentClass ( ) . 'Service' . DIRECTORY_SEPARATOR . 'Container' . DIRECTORY_SEPARATOR . $ container . '.php' ; return file_exists ( $ filename ) ? ( include_once $ filename ) : false ; } | Checks existence of a container and returns result . |
31,225 | protected function setContainer ( $ container , array $ containerOptions = [ ] ) { if ( $ this -> containerExists ( $ container ) === false ) { throw new Doozr_Cache_Service_Exception ( sprintf ( 'Error! Container: "%s" does not exist! Please choose an existing container.' , $ container ) ) ; } return $ this -> container = $ this -> containerFactory ( $ container , array_merge ( $ this -> getDefaultOptions ( ) , $ containerOptions ) ) ; } | Setter for container . |
31,226 | protected function createExtended ( $ key , $ value , $ lifetime , $ scope , $ userdata = '' ) { try { $ result = $ this -> getContainer ( ) -> create ( $ key , $ value , $ lifetime , $ scope , $ userdata ) ; } catch ( Exception $ e ) { throw new Doozr_Cache_Service_Exception ( sprintf ( 'Error creating cache entry for with key: "%s".' , $ key ) ) ; } return $ result !== false ; } | Stores a dataset with additional user - defined data . |
31,227 | protected function containerFactory ( $ container , array $ containerOptions = [ ] ) { $ container = ucfirst ( strtolower ( $ container ) ) ; $ class = __CLASS__ . '_Container_' . $ container ; $ file = DOOZR_DOCUMENT_ROOT . 'Service' . DIRECTORY_SEPARATOR . str_replace ( '_' , DIRECTORY_SEPARATOR , $ class ) . '.php' ; include_once $ file ; return new $ class ( $ containerOptions ) ; } | Factory for container . |
31,228 | public function tracker ( $ name = 'default' ) { $ key = 'endroid_google_analytics.' . $ name ; if ( ! $ this -> container -> hasParameter ( $ key ) ) { return '' ; } $ tracker = $ this -> container -> getParameter ( $ key ) ; $ tracker [ 'name' ] = $ name ; $ html = $ this -> container -> get ( 'templating' ) -> render ( 'EndroidGoogleAnalyticsBundle::tracker.html.twig' , array ( 'tracker' => $ tracker , 'loadGa' => $ this -> firstTracker ) ) ; $ this -> firstTracker = false ; return $ html ; } | Renders the tracker . |
31,229 | public function get ( $ objectId , $ useMasterKey = false ) { $ this -> equalTo ( 'objectId' , $ objectId ) ; $ result = $ this -> first ( $ useMasterKey ) ; if ( empty ( $ result ) ) { throw new AVException ( "Object not found." , 101 ) ; } return $ result ; } | Execute a query to retrieve a specific object |
31,230 | public function equalTo ( $ key , $ value ) { if ( $ value === null ) { $ this -> doesNotExist ( $ key ) ; } else { $ this -> where [ $ key ] = $ value ; } return $ this ; } | Set a constraint for a field matching a given value . |
31,231 | private function addCondition ( $ key , $ condition , $ value ) { if ( ! isset ( $ this -> where [ $ key ] ) ) { $ this -> where [ $ key ] = array ( ) ; } $ this -> where [ $ key ] [ $ condition ] = AVClient :: _encode ( $ value , true ) ; } | Helper for condition queries . |
31,232 | public function startsWith ( $ key , $ value ) { $ this -> addCondition ( $ key , '$regex' , "^" . $ this -> quote ( $ value ) ) ; return $ this ; } | Add a constraint to the query that requires a particular key s value to start with the provided value . |
31,233 | public function _getOptions ( ) { $ opts = array ( ) ; if ( ! empty ( $ this -> where ) ) { $ opts [ 'where' ] = $ this -> where ; } if ( count ( $ this -> includes ) ) { $ opts [ 'include' ] = join ( ',' , $ this -> includes ) ; } if ( count ( $ this -> selectedKeys ) ) { $ opts [ 'keys' ] = join ( ',' , $ this -> selectedKeys ) ; } if ( $ this -> limit >= 0 ) { $ opts [ 'limit' ] = $ this -> limit ; } if ( $ this -> skip > 0 ) { $ opts [ 'skip' ] = $ this -> skip ; } if ( $ this -> orderBy ) { $ opts [ 'order' ] = join ( ',' , $ this -> orderBy ) ; } if ( $ this -> count ) { $ opts [ 'count' ] = $ this -> count ; } return $ opts ; } | Returns an associative array of the query constraints . |
31,234 | public function first ( $ useMasterKey = false ) { $ this -> limit = 1 ; $ result = $ this -> find ( $ useMasterKey ) ; if ( count ( $ result ) ) { return $ result [ 0 ] ; } else { return array ( ) ; } } | Execute a query to get only the first result . |
31,235 | private function buildQueryString ( $ queryOptions ) { if ( isset ( $ queryOptions [ "where" ] ) ) { $ queryOptions [ "where" ] = AVClient :: _encode ( $ queryOptions [ "where" ] , true ) ; $ queryOptions [ "where" ] = json_encode ( $ queryOptions [ "where" ] ) ; } return http_build_query ( $ queryOptions ) ; } | Build query string from query constraints . |
31,236 | public function count ( $ useMasterKey = false ) { $ this -> limit = 0 ; $ this -> count = 1 ; $ queryString = $ this -> buildQueryString ( $ this -> _getOptions ( ) ) ; $ result = AVClient :: _request ( 'GET' , '/classes/' . $ this -> className . '?' . $ queryString , null , null , $ useMasterKey ) ; return $ result [ 'count' ] ; } | Execute a count query and return the count . |
31,237 | public function find ( $ useMasterKey = false ) { $ sessionToken = null ; if ( AVUser :: getCurrentUser ( ) ) { $ sessionToken = AVUser :: getCurrentUser ( ) -> getSessionToken ( ) ; } $ queryString = $ this -> buildQueryString ( $ this -> _getOptions ( ) ) ; $ result = AVClient :: _request ( 'GET' , '/classes/' . $ this -> className . '?' . $ queryString , $ sessionToken , null , $ useMasterKey ) ; $ output = array ( ) ; foreach ( $ result [ 'results' ] as $ row ) { $ obj = AVObject :: create ( $ this -> className , $ row [ 'objectId' ] ) ; $ obj -> _mergeAfterFetchWithSelectedKeys ( $ row , $ this -> selectedKeys ) ; $ output [ ] = $ obj ; } return $ output ; } | Execute a find query and return the results . |
31,238 | public function withinRadians ( $ key , $ point , $ maxDistance ) { $ this -> near ( $ key , $ point ) ; $ this -> addCondition ( $ key , '$maxDistance' , $ maxDistance ) ; return $ this ; } | Add a proximity based constraint for finding objects with key point values near the point given and within the maximum distance given . |
31,239 | public function withinMiles ( $ key , $ point , $ maxDistance ) { $ this -> near ( $ key , $ point ) ; $ this -> addCondition ( $ key , '$maxDistance' , $ maxDistance / 3958.8 ) ; return $ this ; } | Add a proximity based constraint for finding objects with key point values near the point given and within the maximum distance given . Radius of earth used is 3958 . 5 miles . |
31,240 | public function withinKilometers ( $ key , $ point , $ maxDistance ) { $ this -> near ( $ key , $ point ) ; $ this -> addCondition ( $ key , '$maxDistance' , $ maxDistance / 6371.0 ) ; return $ this ; } | Add a proximity based constraint for finding objects with key point values near the point given and within the maximum distance given . Radius of earth used is 6371 . 0 kilometers . |
31,241 | public function withinGeoBox ( $ key , $ southwest , $ northeast ) { $ this -> addCondition ( $ key , '$within' , [ '$box' => [ $ southwest , $ northeast ] ] ) ; return $ this ; } | Add a constraint to the query that requires a particular key s coordinates be contained within a given rectangular geographic bounding box . |
31,242 | public function each ( $ callback , $ useMasterKey = false , $ batchSize = 100 ) { if ( $ this -> orderBy || $ this -> skip || ( $ this -> limit >= 0 ) ) { throw new \ Exception ( "Cannot iterate on a query with sort, skip, or limit." ) ; } $ query = new AVQuery ( $ this -> className ) ; $ query -> where = $ this -> where ; $ query -> includes = $ this -> includes ; $ query -> limit = $ batchSize ; $ query -> ascending ( "objectId" ) ; $ finished = false ; while ( ! $ finished ) { $ results = $ query -> find ( $ useMasterKey ) ; $ length = count ( $ results ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ callback ( $ results [ $ i ] ) ; } if ( $ length == $ query -> limit ) { $ query -> greaterThan ( "objectId" , $ results [ $ length - 1 ] -> getObjectId ( ) ) ; } else { $ finished = true ; } } } | Iterates over each result of a query calling a callback for each one . The items are processed in an unspecified order . The query may not have any sort order and may not use limit or skip . |
31,243 | public function matchesQuery ( $ key , $ query ) { $ queryParam = $ query -> _getOptions ( ) ; $ queryParam [ "className" ] = $ query -> className ; $ this -> addCondition ( $ key , '$inQuery' , $ queryParam ) ; return $ this ; } | Add a constraint that requires that a key s value matches a AVQuery constraint . |
31,244 | public function doesNotMatchQuery ( $ key , $ query ) { $ queryParam = $ query -> _getOptions ( ) ; $ queryParam [ "className" ] = $ query -> className ; $ this -> addCondition ( $ key , '$notInQuery' , $ queryParam ) ; return $ this ; } | Add a constraint that requires that a key s value not matches a AVQuery constraint . |
31,245 | public function matchesKeyInQuery ( $ key , $ queryKey , $ query ) { $ queryParam = $ query -> _getOptions ( ) ; $ queryParam [ "className" ] = $ query -> className ; $ this -> addCondition ( $ key , '$select' , [ 'key' => $ queryKey , 'query' => $ queryParam ] ) ; return $ this ; } | Add a constraint that requires that a key s value matches a value in an object returned by the given query . |
31,246 | public static function orQueries ( $ queryObjects ) { $ className = null ; $ length = count ( $ queryObjects ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { if ( is_null ( $ className ) ) { $ className = $ queryObjects [ $ i ] -> className ; } if ( $ className != $ queryObjects [ $ i ] -> className ) { throw new \ Exception ( "All queries must be for the same class" ) ; } } $ query = new AVQuery ( $ className ) ; $ query -> _or ( $ queryObjects ) ; return $ query ; } | Constructs a AVQuery object that is the OR of the passed in queries objects . All queries must have same class name . |
31,247 | private function _or ( $ queries ) { $ this -> where [ '$or' ] = array ( ) ; $ length = count ( $ queries ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ this -> where [ '$or' ] [ ] = $ queries [ $ i ] -> where ; } return $ this ; } | Add constraint that at least one of the passed in queries matches . |
31,248 | public function select ( $ key ) { if ( is_array ( $ key ) ) { $ this -> selectedKeys = array_merge ( $ this -> selectedKeys , $ key ) ; } else { $ this -> selectedKeys [ ] = $ key ; } return $ this ; } | Restrict the fields of the returned Avos Objects to include only the provided keys . If this is called multiple times then all of the keys specified in each of the calls will be included . |
31,249 | public function includeKey ( $ key ) { if ( is_array ( $ key ) ) { $ this -> includes = array_merge ( $ this -> includes , $ key ) ; } else { $ this -> includes [ ] = $ key ; } } | Include nested Avos Objects for the provided key . You can use dot notation to specify which fields in the included object are also fetch . |
31,250 | public function uploadBase64 ( ImageInterface $ image , $ content , array $ options = [ ] ) { $ this -> tmpFile -> create ( ) -> write ( base64_decode ( $ content ) ) ; try { $ image = $ this -> upload ( $ image , $ this -> tmpFile -> getPath ( ) , $ options ) ; } finally { $ this -> tmpFile -> clear ( ) ; } return $ image ; } | Upload by base64 encoded source |
31,251 | static function TryParse ( $ string , & $ result ) { $ result = null ; $ strNumber = trim ( $ string ) ; $ decPoint = self :: $ _separator1 ; $ thousandSep = self :: $ _separator2 ; if ( ! self :: EvaluateSeparators ( $ strNumber , $ decPoint , $ thousandSep ) ) { return false ; } $ strFiltered = preg_replace ( "/[^0-9\.\,\-\+]/" , "" , $ strNumber ) ; $ strPrepared = str_replace ( $ thousandSep , '' , $ strFiltered ) ; $ strNormalized = str_replace ( $ decPoint , '.' , $ strPrepared ) ; $ result = floatval ( $ strNormalized ) ; return true ; } | Parses the number globally . Note that Strings like 1 . 000 or 1 000 will lead to 1 . 0 as result while 1 . 000 . 000 or 1 000 000 will result in 1 millionen . |
31,252 | static function Parse ( $ string ) { $ result = null ; if ( ! self :: TryParse ( $ string , $ result ) ) { throw new \ InvalidArgumentException ( "'$string' could not be converted to a number" ) ; } return $ result ; } | Parses a string to a number |
31,253 | static public function traceMemory ( $ context = null ) { $ caller = static :: getCaller ( ) ; $ memory_usage = memory_get_usage ( ) ; $ message = sprintf ( '%30s::%-15s: %s' , $ caller [ 'class' ] , $ caller [ 'function' ] , $ memory_usage ) ; if ( $ context ) { $ message .= ' ' . print_r ( $ context , true ) ; } Ioc :: logger ( 'trace' ) -> debug ( sprintf ( '[%s]%s' , 'memory' , $ message ) ) ; } | trace memory usage |
31,254 | public static function make ( ) { $ name = get_called_class ( ) ; if ( ! isset ( static :: $ instances [ $ name ] ) ) { $ instance = new $ name ( ) ; static :: $ instances [ $ name ] = method_exists ( $ instance , 'boot' ) ? $ instance -> boot ( ) : $ instance ; } return static :: $ instances [ $ name ] ; } | Returns an instance of Zit or an extending class |
31,255 | public function bind ( $ id , callable $ serviceGenerator ) { $ this -> callables [ ( string ) $ id ] = function ( $ zit ) use ( $ serviceGenerator ) { static $ object ; if ( null === $ object ) { $ object = $ serviceGenerator ( $ zit ) ; } return $ object ; } ; } | Binds the service generator and resolves it by its id |
31,256 | public function extend ( $ id , callable $ callback ) { if ( is_callable ( $ callback ) || method_exists ( $ callback , '__invoke' ) ) { $ this -> callables [ $ id ] = $ callback ; } } | Binds the callable function and executes it by its id |
31,257 | protected function pop ( $ id , $ args = array ( ) ) { if ( array_key_exists ( $ id , $ this -> services ) ) { return $ this -> services [ $ id ] ; } if ( array_key_exists ( $ id , $ this -> callables ) ) { $ callback = $ this -> callables [ $ id ] ; return call_user_func_array ( $ callback , array_merge ( array ( $ this ) , $ args ) ) ; } throw new \ Exception ( "The dependency with id of ({$id}) is missing." ) ; } | Pops a dependency out of the container |
31,258 | public function resetPassword ( User $ user ) { $ newPassword = uniqid ( time ( ) , true ) ; $ user -> setPassword ( $ newPassword ) ; $ this -> save ( $ user ) ; return $ newPassword ; } | Reset the Password for given User |
31,259 | public function login ( User $ user , $ password ) { if ( $ user -> isPasswordValid ( $ password ) ) { $ token = new UsernamePasswordToken ( $ user , null , 'main' , $ user -> getRoles ( ) ) ; $ this -> tokenStorage -> setToken ( $ token ) ; $ user -> setLastLogin ( new \ DateTime ( ) ) ; $ this -> save ( $ user ) ; return true ; } return false ; } | Log in the given User |
31,260 | private function loadXML ( ) { $ xml = str_replace ( $ this -> replaceNamespaces , '' , $ this -> getXml ( ) ) ; $ this -> xmlData = \ simplexml_load_string ( $ xml ) ; } | Parse the XML data |
31,261 | public static function register ( ) { self :: $ root = null ; if ( true === self :: $ registered ) { return ; } if ( @ stream_wrapper_register ( vfsStream :: SCHEME , __CLASS__ ) === false ) { throw new vfsStreamException ( 'A handler has already been registered for the ' . vfsStream :: SCHEME . ' protocol.' ) ; } self :: $ registered = true ; } | method to register the stream wrapper |
31,262 | protected function splitPath ( $ path ) { $ lastSlashPos = strrpos ( $ path , '/' ) ; if ( false === $ lastSlashPos ) { return array ( 'dirname' => '' , 'basename' => $ path ) ; } return array ( 'dirname' => substr ( $ path , 0 , $ lastSlashPos ) , 'basename' => substr ( $ path , $ lastSlashPos + 1 ) ) ; } | splits path into its dirname and the basename |
31,263 | protected function calculateMode ( $ mode , $ extended ) { if ( true === $ extended ) { return self :: ALL ; } if ( self :: READ === $ mode ) { return self :: READONLY ; } return self :: WRITEONLY ; } | calculates the file runtimeEnvironment |
31,264 | public function url_stat ( $ path , $ flags ) { $ content = $ this -> getContent ( $ this -> resolvePath ( vfsStream :: path ( $ path ) ) ) ; if ( null === $ content ) { if ( ( $ flags & STREAM_URL_STAT_QUIET ) != STREAM_URL_STAT_QUIET ) { trigger_error ( ' No such file or directory: ' . $ path , E_USER_WARNING ) ; } return false ; } $ fileStat = array ( 'dev' => 0 , 'ino' => 0 , 'runtimeEnvironment' => $ content -> getType ( ) | $ content -> getPermissions ( ) , 'nlink' => 0 , 'uid' => $ content -> getUser ( ) , 'gid' => $ content -> getGroup ( ) , 'rdev' => 0 , 'size' => $ content -> size ( ) , 'atime' => $ content -> fileatime ( ) , 'mtime' => $ content -> filemtime ( ) , 'ctime' => $ content -> filectime ( ) , 'blksize' => - 1 , 'blocks' => - 1 ) ; return array_merge ( array_values ( $ fileStat ) , $ fileStat ) ; } | returns status of url |
31,265 | static function Shorten ( $ str , $ length = 32 , $ respectWords = false , $ noEllipsis = false , $ forceEllipsis = false , $ entityDecode = false ) { if ( $ entityDecode ) $ str = html_entity_decode ( $ str , ENT_COMPAT , 'utf-8' ) ; $ str = Str :: Trim ( strip_tags ( $ str ) ) ; if ( strlen ( $ str ) <= $ length ) { if ( $ forceEllipsis ) return self :: CorrectSpaces ( $ str ) . "..." ; else return self :: CorrectSpaces ( $ str ) ; } $ str = mb_substr ( $ str , 0 , $ length - 3 , 'utf-8' ) ; if ( $ respectWords ) { $ pos = mb_strrpos ( $ str , " " , - 1 , 'utf-8' ) ; if ( $ pos > $ length / 2 ) $ str = mb_substr ( $ str , 0 , $ pos , 'utf-8' ) ; } $ str = self :: CorrectSpaces ( $ str ) ; if ( ! $ noEllipsis ) $ str = $ str . "..." ; return $ str ; } | Cuts off text of desired length |
31,266 | static function CorrectSpaces ( $ text ) { $ chars = '!,;.?:' ; $ charArray = str_split ( $ chars ) ; foreach ( $ charArray as $ char ) { $ text = Str :: Replace ( $ char , $ char . ' ' , $ text ) ; } return self :: RemoveMultipleSpaces ( $ text ) ; } | Corrects spaces after syntax characters and erases multiple spaces |
31,267 | public function make ( string $ path , array $ data = [ ] ) { $ cached = $ this -> isCached ( $ path ) ; extract ( $ data ) ; ob_start ( ) ; eval ( '?> ' . $ cached ) ; $ output = ob_get_contents ( ) ; ; ob_end_clean ( ) ; return $ output ; } | Make a new view |
31,268 | private function isCached ( string $ path ) { $ views = glob ( $ this -> cacheDirectory . $ this -> DS . '*' . str_replace ( $ this -> DS , ' ' , $ path ) ) ; if ( count ( $ views ) > 0 ) { $ this -> canRecache ( $ path , $ views [ 0 ] ) ; return file_get_contents ( $ views [ 0 ] ) == null ? ' ' : file_get_contents ( $ views [ 0 ] ) ; } else { $ this -> cache ( $ path , uniqid ( ) ) ; } $ views = glob ( $ this -> cacheDirectory . $ this -> DS . '*' . str_replace ( $ this -> DS , ' ' , $ path ) ) ; if ( count ( $ views ) > 0 ) { return file_get_contents ( $ views [ 0 ] ) == null ? ' ' : file_get_contents ( $ views [ 0 ] ) ; } } | Cache view and return cached view |
31,269 | private function canRecache ( $ path , $ cached ) { $ old = file_get_contents ( $ cached ) ; preg_match_all ( '/\<\!\-\-\%(.*?)\%\-\-\>/' , $ old , $ views ) ; foreach ( $ views [ 1 ] as $ view ) { $ fp = $ this -> viewsDirectory . $ this -> DS . base64_decode ( $ view , true ) . $ this -> viewsExtension ; if ( file_exists ( $ fp ) ) { if ( filemtime ( $ fp ) > filemtime ( $ cached ) ) { return file_put_contents ( $ cached , $ this -> recache ( $ path ) ) ; } continue ; } return file_put_contents ( $ cached , $ this -> recache ( $ path ) ) ; } if ( filemtime ( $ path ) > filemtime ( $ cached ) ) { file_put_contents ( $ cached , $ this -> recache ( $ path ) ) ; } } | Check if view needs to be cached and return cached view |
31,270 | static public function isToday ( $ value ) { $ time = DataHelper :: toUnixtime ( $ value ) ; $ todayRange = static :: todayRange ( ) ; if ( $ time >= $ todayRange [ 0 ] && $ time <= $ todayRange [ 1 ] ) { return true ; } return false ; } | value is today |
31,271 | public function getMeta ( $ name ) { return $ this -> getMetas ( ) -> filter ( function ( ArticleMeta $ meta ) use ( $ name ) { return $ meta -> getMeta ( ) -> getName ( ) == $ name ; } ) -> first ( ) ; } | Get specific meta by its name |
31,272 | public function getContent ( $ name ) { return $ this -> getContents ( ) -> filter ( function ( Content $ content ) use ( $ name ) { return $ content -> getArea ( ) -> getName ( ) == $ name ; } ) -> first ( ) ; } | Get Article content for Area |
31,273 | private function LanguageCsvFile ( $ basePath ) { $ ext = IO \ Path :: Extension ( $ basePath ) ; $ baseFile = IO \ Path :: RemoveExtension ( $ basePath ) ; $ langFile = IO \ Path :: AddExtension ( $ baseFile , $ this -> language ) ; return IO \ Path :: AddExtension ( $ langFile , $ ext ) ; } | Gets the csv file path for the given language |
31,274 | private function ReadTranslations ( ) { if ( isset ( $ this -> translations [ $ this -> language ] ) ) { return ; } $ this -> translations [ $ this -> language ] = array ( ) ; foreach ( $ this -> basePaths as $ basePath ) { $ handle = @ fopen ( $ this -> LanguageCsvFile ( $ basePath ) , 'r' ) ; if ( ! $ handle ) { return ; } while ( $ line = fgetcsv ( $ handle , 0 , $ this -> delimiter , $ this -> enclosure ) ) { $ this -> ReadCsvLine ( $ line ) ; } } } | Reads translations from language file if not already done |
31,275 | public function index ( $ id ) { $ memberTag = MemberTag :: with ( 'members' ) -> findOrFail ( $ id ) ; $ this -> authorize ( 'index' , $ memberTag ) ; return fractal ( $ memberTag -> members , new IdListTransformer ( ) ) -> withResourceName ( 'memberId' ) -> respond ( ) ; } | Produce a list of Member UUIDs related to a selected MemberTag |
31,276 | public function getIncludes ( ) : array { if ( $ this -> includes === null ) { $ this -> includes = TransformerHelper :: normalizeIncludes ( $ this -> defineIncludes ( ) ) ; } return $ this -> includes ; } | Returns an array of normalized includes . It is recommend |
31,277 | public function run ( $ args ) { $ args = $ this -> parseArgs ( $ args ) ; if ( ! isset ( $ args [ 0 ] ) || ! $ args [ 0 ] ) { return $ this -> publishEverything ( ) ; } if ( ! $ this -> existsProjectName ( $ args [ 0 ] ) ) { return $ this -> error ( '&project-not-found' , [ 'project' => $ args [ 0 ] ] ) ; } $ projectName = $ args [ 0 ] ; $ version = $ this -> getNextVersion ( $ this -> getProjectDir ( $ projectName ) ) ; $ this -> info ( "Publish project '{$projectName}' (git login)" ) ; return $ this -> exec ( 'publish' , 'publish-project' , [ $ projectName , $ version ] ) ; } | Run publish command . |
31,278 | private function publishEverything ( ) { $ root = basename ( $ this -> cwd ) ; $ path = $ this -> cwd . '/' . $ this -> projectsDir ; $ version = $ this -> getNextVersion ( $ this -> cwd ) ; $ this -> info ( "Publish root project '{$root}' (git login)" ) ; $ this -> exec ( 'publish' , 'publish-root-project' , [ $ version ] ) ; foreach ( scandir ( $ path ) as $ name ) { if ( $ name [ 0 ] != '.' && is_dir ( $ path . '/' . $ name ) ) { $ version = $ this -> getNextVersion ( $ path . '/' . $ name ) ; echo "\n" ; $ this -> info ( "Publish project '{$name}' (git login)" ) ; $ this -> exec ( 'publish' , 'publish-project' , [ $ name , $ version ] ) ; } } } | Publish everythings . |
31,279 | private function getNextVersion ( $ path ) { $ file = $ path . '/composer.json' ; if ( ! file_exists ( $ file ) ) { return 'Initial commit' ; } $ json = json_decode ( file_get_contents ( $ file ) ) ; if ( ! isset ( $ json -> version ) ) { return 'Initial commit' ; } $ ver = explode ( '.' , trim ( $ json -> version ) ) ; $ min = array_pop ( $ ver ) ; $ ver [ ] = $ min + 1 ; $ json -> version = implode ( '.' , $ ver ) ; $ size = file_put_contents ( $ file , json_encode ( $ json , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) ) ; if ( ! $ size ) { $ this -> error ( "Error to write file '{$file}'." ) ; } return 'Version ' . $ json -> version ; } | Get next version number . |
31,280 | public function index ( ) { $ categories = Subbly :: api ( 'subbly.category' ) -> all ( ) ; return $ this -> jsonResponse ( array ( 'categories' => $ this -> presenter -> collection ( $ categories ) , ) ) ; } | Get Categories list . |
31,281 | public function addRouteParam ( $ param , $ key = '' ) { $ this -> routeParams [ ] = $ param ; if ( $ key != '' ) { $ this -> routeParams [ $ key ] = $ param ; } } | Adds an parameter which is detected in the route . |
31,282 | public function getRouteParam ( $ key ) { if ( ! isset ( $ this -> routeParams [ $ key ] ) ) { return false ; } return $ this -> routeParams [ $ key ] ; } | Returns the route param for the given index . |
31,283 | public function getFullRoute ( $ routePart = '' ) { if ( $ routePart == '' ) { $ routePart = $ this -> route ; } $ delimiter = $ this -> getRouteDelimiter ( ) ; if ( substr ( $ routePart , 0 , strlen ( $ delimiter ) ) !== $ delimiter ) { $ routePart = $ delimiter . $ routePart ; } $ posPoint = strrpos ( $ routePart , '.' ) ; if ( substr ( $ routePart , - 1 ) !== $ delimiter && ( $ posPoint === false || $ posPoint < strrpos ( $ routePart , $ delimiter ) ) ) { $ routePart .= $ delimiter ; } return $ this -> base . $ routePart ; } | Returns the correct url for the given url part |
31,284 | public function getHeaders ( ) { $ result = [ ] ; foreach ( $ this -> shadow as $ reference => $ index ) { $ result [ $ index ] = $ this -> headers [ $ reference ] ; } return $ result ; } | Getter for headers . |
31,285 | public function hasHeader ( $ name ) { $ internalName = strtolower ( $ name ) ; return ( true === isset ( $ this -> headers [ $ internalName ] ) ) ; } | Returns TRUE if header is set otherwise FALSE . |
31,286 | public function setHeader ( $ name , $ value ) { $ internalName = strtolower ( $ name ) ; if ( true === is_array ( $ value ) ) { $ this -> headers [ $ internalName ] = $ value ; } else { $ this -> headers [ $ internalName ] = array ( $ value ) ; } } | Setter for header . |
31,287 | public function getHeader ( $ name ) { $ internalName = strtolower ( $ name ) ; if ( true === $ this -> hasHeader ( $ internalName ) ) { $ value = $ this -> headers [ $ internalName ] ; } else { $ value = null ; } return $ value ; } | Getter for header . |
31,288 | public function getHeaderLine ( $ name ) { $ internalName = strtolower ( $ name ) ; return ( true === isset ( $ this -> headers [ $ internalName ] ) ) ? implode ( ',' , $ this -> headers [ $ internalName ] ) : '' ; } | Getter for header line . |
31,289 | protected function getShadow ( $ name ) { if ( false === isset ( $ this -> shadow [ $ name ] ) ) { throw new Doozr_Exception_Http ( 500 , sprintf ( 'No shadow entry for "%s"' , $ name ) ) ; } return $ this -> shadow [ $ name ] ; } | Getter for shadow . |
31,290 | public function denyPasswordReset ( $ allow , $ user_id ) { if ( AD_RANDOM_PASSWORD === true ) { if ( ( substr ( get_user_by ( 'id' , $ user_id ) -> user_email , - strlen ( AD_USER_DOMAIN ) ) === AD_USER_DOMAIN ) ) { return false ; } } return true ; } | Prevents password for being reset on ad - users |
31,291 | public function format ( $ number , ArrayObject $ row = null ) : string { $ locale = $ this -> params [ 'locale' ] ; $ formatterId = $ locale . ( string ) $ this -> params [ 'pattern' ] ; if ( ! array_key_exists ( $ formatterId , $ this -> formatters ) ) { $ this -> loadFormatterId ( $ formatterId ) ; } if ( $ this -> currency_column !== null ) { if ( ! isset ( $ row [ $ this -> currency_column ] ) ) { throw new Exception \ RuntimeException ( __METHOD__ . " Cannot determine currency code based on column '{$this->currency_column}'." ) ; } $ value = $ this -> formatters [ $ formatterId ] -> formatCurrency ( ( float ) $ number , $ row [ $ this -> currency_column ] ) ; } else { if ( $ this -> params [ 'currency_code' ] == '' ) { throw new Exception \ RuntimeException ( __METHOD__ . ' Currency code must be set prior to use the currency formatter' ) ; } $ value = $ this -> formatters [ $ formatterId ] -> formatCurrency ( ( float ) $ number , $ this -> params [ 'currency_code' ] ) ; } if ( intl_is_failure ( $ this -> formatters [ $ formatterId ] -> getErrorCode ( ) ) ) { $ this -> throwNumberFormatterException ( $ this -> formatters [ $ formatterId ] , $ number ) ; } return $ value ; } | Currency format a number . |
31,292 | public function parse ( $ value ) { $ locale = $ this -> params [ 'locale' ] ; $ formatterId = $ locale ; if ( ! array_key_exists ( $ formatterId , $ this -> formatters ) ) { $ this -> loadFormatterId ( $ formatterId ) ; } $ currency = null ; $ result = $ this -> formatters [ $ formatterId ] -> parseCurrency ( $ value , $ currency ) ; if ( $ result === false ) { return null ; } return [ 'value' => $ result , 'currency' => $ currency ] ; } | Parse a . |
31,293 | public function setCurrencyCode ( $ currencyCode ) : self { if ( $ currencyCode instanceof RowColumn ) { $ this -> currency_column = $ currencyCode -> getColumnName ( ) ; } elseif ( ! is_string ( $ currencyCode ) || trim ( $ currencyCode ) === '' ) { throw new Exception \ InvalidArgumentException ( __METHOD__ . ' Currency code must be an non empty string (or a RowColumn object)' ) ; } $ this -> params [ 'currency_code' ] = $ currencyCode ; return $ this ; } | The 3 - letter ISO 4217 currency code indicating the currency to use . |
31,294 | public function run ( $ data , $ id = null ) { $ this -> hr ( ) ; $ this -> out ( __d ( 'cake_ldap' , 'CakePHP Queue Sync task.' ) ) ; if ( empty ( $ data ) || ! is_array ( $ data ) ) { $ data = [ ] ; } $ dataDefault = [ 'guid' => null , ] ; $ data += $ dataDefault ; extract ( $ data ) ; if ( empty ( $ guid ) ) { $ queueLength = $ this -> ExtendQueuedTask -> getLengthQueue ( 'SyncEmployee' ) ; if ( $ queueLength > 0 ) { $ this -> out ( __d ( 'cake_ldap' , 'Found sync task in queue: %d. Skipped.' , $ queueLength ) ) ; return true ; } } $ this -> Sync -> syncInformation ( $ guid , $ id ) ; return true ; } | Main function . Used for synchronization information of employees with Active Directory . |
31,295 | protected function getTable ( ) { $ table = parent :: getTable ( ) ; if ( $ table instanceof SelectQuery ) return "(" . $ table -> get ( false ) . ")" ; return $ table ; } | Allow the table to be a SelectQuery |
31,296 | public function frontend_allowed_ip_addresses ( $ request ) { $ frontend_allowed_ip_addresses = config ( 'lasallecmsfrontend.frontend_allowed_ip_addresses' ) ; if ( empty ( $ frontend_allowed_ip_addresses ) ) return true ; $ requestIPAddress = $ this -> customAdminAuthChecks -> getRequestIPAddress ( $ request ) ; return $ this -> customAdminAuthChecks -> ipAddressCheck ( $ frontend_allowed_ip_addresses , $ requestIPAddress ) ; } | Check if the current IP address is allowed to look at the front end . |
31,297 | public function frontend_excluded_ip_addresses ( $ request ) { $ frontend_excluded_ip_addresses = config ( 'lasallecmsfrontend.frontend_excluded_ip_addresses' ) ; if ( empty ( $ frontend_excluded_ip_addresses ) ) return false ; $ requestIPAddress = $ this -> customAdminAuthChecks -> getRequestIPAddress ( $ request ) ; return $ this -> customAdminAuthChecks -> ipAddressCheck ( $ frontend_excluded_ip_addresses , $ requestIPAddress ) ; } | Check if the current IP address is excluded from looking at the front end . |
31,298 | public function resize ( $ newWidth = null , $ newHeight = null ) { if ( ! is_numeric ( $ newHeight ) && ! is_numeric ( $ newWidth ) ) { throw new InvalidArgumentException ( 'There are no valid values' ) ; } $ height = $ this -> getHeight ( ) ; $ width = $ this -> getWidth ( ) ; if ( ! $ newHeight && $ newWidth ) { $ newHeight = $ height * $ newWidth / $ width ; } if ( $ newHeight && ! $ newWidth ) { $ newWidth = $ width * $ newHeight / $ height ; } $ newImage = imagecreatetruecolor ( $ newWidth , $ newHeight ) ; imagealphablending ( $ newImage , false ) ; imagecopyresampled ( $ newImage , $ this -> image , 0 , 0 , 0 , 0 , $ newWidth , $ newHeight , $ width , $ height ) ; $ this -> image = $ newImage ; return $ this ; } | Resize the image to an new size . Size can be specified in the arugments . |
31,299 | public function resizeSquare ( $ newSize , $ fillRed = 255 , $ fillGreen = 255 , $ fillBlue = 255 ) { return $ this -> resizeAspectRatio ( $ newSize , $ newSize , $ fillRed , $ fillGreen , $ fillBlue ) ; } | Resize the image in a square format and maintain the aspect ratio . The space are filled the RGB color provided . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.