idx
int64 0
60.3k
| question
stringlengths 101
6.21k
| target
stringlengths 7
803
|
|---|---|---|
60,000
|
public function check_storage ( ) { $ this -> line ( ' * Checking storage' ) ; if ( ! File :: isWritable ( storage_path ( ) ) ) $ this -> error ( storage_path ( ) . ' is not writable' ) ; else $ this -> info ( storage_path ( ) . ' is writable' ) ; if ( ! File :: isWritable ( config ( 'eveapi.config.eseye_logfile' ) ) ) $ this -> error ( config ( 'eveapi.config.eseye_logfile' ) . ' is not writable' ) ; else $ this -> info ( config ( 'eveapi.config.eseye_logfile' ) . ' is writable' ) ; if ( ! File :: isWritable ( config ( 'eveapi.config.eseye_cache' ) ) ) $ this -> error ( config ( 'eveapi.config.eseye_cache' ) . ' is not writable' ) ; else $ this -> info ( config ( 'eveapi.config.eseye_cache' ) . ' is writable' ) ; if ( ! File :: isWritable ( storage_path ( ) . '/sde/' ) ) $ this -> error ( storage_path ( ) . '/sde/' . ' is not writable' ) ; else $ this -> info ( storage_path ( ) . '/sde/' . ' is writable' ) ; if ( ! File :: isWritable ( storage_path ( sprintf ( 'logs/laravel-%s.log' , carbon ( ) -> toDateString ( ) ) ) ) ) $ this -> error ( storage_path ( sprintf ( 'logs/laravel-%s.log is not writable' , carbon ( ) -> toDateString ( ) ) ) ) ; else $ this -> info ( storage_path ( sprintf ( 'logs/laravel-%s.log is writable' , carbon ( ) -> toDateString ( ) ) ) ) ; }
|
Check access to some important storage paths .
|
60,001
|
public function check_database ( ) { $ this -> line ( ' * Checking Database' ) ; $ this -> table ( [ 'Setting' , 'Value' ] , [ [ 'Connection' , env ( 'DB_CONNECTION' ) ] , [ 'Host' , env ( 'DB_HOST' ) ] , [ 'Database' , env ( 'DB_DATABASE' ) ] , [ 'Username' , env ( 'DB_USERNAME' ) ] , [ 'Password' , str_repeat ( '*' , strlen ( env ( 'DB_PASSWORD' ) ) ) ] , ] ) ; try { $ this -> info ( 'Connection OK to database: ' . DB :: connection ( ) -> getDatabaseName ( ) ) ; } catch ( Exception $ e ) { $ this -> error ( 'Unable to connect to database server: ' . $ e -> getMessage ( ) ) ; } }
|
Check if database access is OK .
|
60,002
|
public function check_redis ( ) { $ this -> line ( ' * Checking Redis' ) ; $ this -> table ( [ 'Setting' , 'Value' ] , [ [ 'Host' , config ( 'database.redis.default.host' ) ] , [ 'Port' , config ( 'database.redis.default.port' ) ] , [ 'Database' , config ( 'database.redis.default.database' ) ] , ] ) ; $ test_key = str_random ( 64 ) ; try { if ( config ( 'database.redis.default.path' ) && config ( 'database.redis.default.scheme' ) ) { $ redis = new Client ( [ 'scheme' => config ( 'database.redis.default.scheme' ) , 'path' => config ( 'database.redis.default.path' ) , ] ) ; } else { $ redis = new Client ( [ 'host' => config ( 'database.redis.default.host' ) , 'port' => config ( 'database.redis.default.port' ) , ] ) ; } $ this -> info ( 'Connected to Redis' ) ; $ redis -> set ( $ test_key , Carbon :: now ( ) ) ; $ this -> info ( 'Set random key of: ' . $ test_key ) ; $ redis -> expire ( $ test_key , 10 ) ; $ this -> info ( 'Set key to expire in 10 sec' ) ; $ redis -> get ( $ test_key ) ; $ this -> info ( 'Read key OK' ) ; } catch ( Exception $ e ) { $ this -> error ( 'Redis test failed. ' . $ e -> getMessage ( ) ) ; } }
|
Check of redis access is OK .
|
60,003
|
public function check_pheal ( ) { $ this -> line ( ' * Checking ESI Access' ) ; $ esi = app ( 'esi-client' ) -> get ( ) ; $ esi -> setVersion ( 'v1' ) ; Configuration :: getInstance ( ) -> cache = NullCache :: class ; try { $ result = $ esi -> invoke ( 'get' , '/status/' ) ; $ this -> info ( 'Server Online Since: ' . $ result -> start_time ) ; $ this -> info ( 'Online Players: ' . $ result -> players ) ; } catch ( RequestFailedException $ e ) { $ this -> error ( 'ESI does not appear to be available: ' . $ e -> getMessage ( ) ) ; } $ this -> info ( 'ESI appears to be OK' ) ; }
|
Check if access to the EVE API OK .
|
60,004
|
public function init ( $ data = null ) { if ( $ this -> initialized ) { return $ this ; } if ( is_null ( $ data ) ) { $ data = $ this -> fetchData ( ) ; } if ( $ this -> isInitialized ( $ data ) ) { $ this -> initialized = true ; } $ this -> data = $ data ; if ( $ this -> initialized ) { $ this -> onData ( $ data ) ; } return $ this ; }
|
Load data onto this object . Chainable method .
|
60,005
|
protected function url ( $ path = '' , $ query = [ ] ) { $ path = $ this -> urlBase ( ) . $ path ; $ query = http_build_query ( array_merge ( $ this -> params , $ query ) ) ; $ url = $ path ; if ( ! empty ( $ query ) ) { $ url .= '?' . $ query ; } return $ url ; }
|
Build a relative URL for a resource .
|
60,006
|
public function getItem ( ) { if ( isset ( $ this -> barcode ) ) { return $ this -> client -> items -> fromBarcode ( $ this -> barcode ) ; } }
|
Get the related Item if any .
|
60,007
|
public function parseSections ( array $ sections , Configuration $ configuration = null ) { if ( is_null ( $ configuration ) ) { $ configuration = new Configuration ( ) ; } foreach ( $ sections as $ sectionName => $ section ) { $ name = explode ( ':' , $ sectionName , 2 ) ; $ class = $ configuration -> findSection ( $ name [ 0 ] ) ; if ( false === $ class ) { $ class = 'Supervisor\Configuration\Section\GenericSection' ; $ name [ 1 ] = $ sectionName ; } if ( isset ( $ name [ 1 ] ) ) { $ section = new $ class ( $ name [ 1 ] , $ section ) ; } else { $ section = new $ class ( $ section ) ; } $ configuration -> addSection ( $ section ) ; } return $ configuration ; }
|
Parses a section array .
|
60,008
|
protected function arrayToHtml ( $ content , $ html = '' ) { if ( is_scalar ( $ content ) ) { return $ content ; } $ html = "<ul>\n" ; foreach ( $ content as $ field => $ value ) { $ html .= "<li><strong>" . $ field . ":</strong> " ; if ( is_array ( $ value ) ) { $ html .= $ this -> arrayToHtml ( $ value ) ; } else { if ( is_bool ( $ value ) ) { $ value = $ value ? 'true' : 'false' ; } $ value = htmlentities ( $ value , ENT_COMPAT , 'UTF-8' ) ; if ( ( strpos ( $ value , 'http://' ) === 0 ) || ( strpos ( $ value , 'https://' ) === 0 ) ) { $ html .= "<a href=\"" . $ value . "\">" . $ value . "</a>" ; } else { $ html .= $ value ; } } $ html .= "</li>\n" ; } $ html .= "</ul>\n" ; return $ html ; }
|
Recursively render an array to an HTML list
|
60,009
|
protected function determineMediaType ( $ acceptHeader ) { if ( ! empty ( $ acceptHeader ) ) { $ negotiator = new Negotiator ( ) ; $ mediaType = $ negotiator -> getBest ( $ acceptHeader , $ this -> knownMediaTypes ) ; if ( $ mediaType ) { return $ mediaType -> getValue ( ) ; } } return $ this -> getDefaultMediaType ( ) ; }
|
Read the accept header and determine which media type we know about is wanted .
|
60,010
|
public function determinePeferredFormat ( $ acceptHeader , $ allowedFormats = [ 'json' , 'xml' , 'html' ] , $ default = 'json' ) { if ( empty ( $ acceptHeader ) ) { return $ default ; } $ negotiator = new Negotiator ( ) ; try { $ elements = $ negotiator -> getOrderedElements ( $ acceptHeader ) ; } catch ( InvalidMediaType $ e ) { return $ default ; } foreach ( $ elements as $ element ) { $ subpart = $ element -> getSubPart ( ) ; foreach ( $ allowedFormats as $ format ) { if ( stripos ( $ subpart , $ format ) !== false ) { return $ format ; } } } return $ default ; }
|
Read the accept header and work out which format is preferred
|
60,011
|
protected function renderXml ( $ data ) { $ xml = $ this -> arrayToXml ( $ data ) ; $ dom = new \ DOMDocument ( '1.0' ) ; $ dom -> preserveWhiteSpace = false ; $ dom -> formatOutput = $ this -> pretty ; $ dom -> loadXML ( $ xml -> asXML ( ) ) ; return $ dom -> saveXML ( ) ; }
|
Render Array as XML
|
60,012
|
public function setObject ( \ Smarty $ object = null ) { $ this -> object = $ object ? $ object : new \ Smarty ( ) ; return $ this ; }
|
Set Smarty object
|
60,013
|
public function setOptions ( array $ options ) { foreach ( $ options as $ key => $ value ) { $ this -> options [ $ key ] = $ value ; $ value && $ this -> object -> $ key = $ value ; } return $ this ; }
|
Set property value for Smarty
|
60,014
|
public function inMimeType ( $ findMe , $ mimeTypes ) { foreach ( $ mimeTypes as $ mimeType ) { if ( $ mimeType == $ findMe ) { return true ; } $ type = strstr ( $ mimeType , '/*' , true ) ; if ( $ type && $ type === strstr ( $ findMe , '/' , true ) ) { return true ; } } return false ; }
|
Checks if a mime type exists in a mime type array
|
60,015
|
protected function setMaxSize ( $ maxSize ) { $ this -> maxSize = $ this -> toBytes ( $ maxSize ) ; $ this -> maxSizeString = $ this -> fromBytes ( $ this -> maxSize ) ; return $ this ; }
|
Set maximum file size
|
60,016
|
protected function setMinSize ( $ minSize ) { $ this -> minSize = $ this -> toBytes ( $ minSize ) ; $ this -> minSizeString = $ this -> fromBytes ( $ this -> minSize ) ; return $ this ; }
|
Set the minimum file size
|
60,017
|
public function getMimeType ( ) { if ( ! $ this -> mimeType ) { $ finfo = finfo_open ( FILEINFO_MIME_TYPE , $ this -> magicFile ) ; if ( ! $ finfo ) { throw new \ UnexpectedValueException ( 'Failed to open fileinfo database' ) ; } $ this -> mimeType = finfo_file ( $ finfo , $ this -> file ) ; } return $ this -> mimeType ; }
|
Returns the file mime type on success
|
60,018
|
public function getExt ( ) { if ( is_null ( $ this -> ext ) && $ this -> originFile ) { $ file = basename ( $ this -> originFile ) ; if ( false !== $ pos = strrpos ( $ file , '.' ) ) { $ this -> ext = strtolower ( substr ( $ file , $ pos + 1 ) ) ; } else { $ this -> ext = '' ; } } return $ this -> ext ; }
|
Returns the file extension if file is not exists return null instead
|
60,019
|
public function getFile ( $ key ) { $ key = str_replace ( $ this -> illegalChars , '_' , $ this -> namespace . $ key ) ; return $ this -> dir . '/' . $ key . '.' . $ this -> ext ; }
|
Get cache file by key
|
60,020
|
public function setDir ( $ dir ) { if ( ! is_dir ( $ dir ) && ! @ mkdir ( $ dir , 0755 , true ) ) { $ message = sprintf ( 'Failed to create directory "%s"' , $ dir ) ; ( $ e = error_get_last ( ) ) && $ message .= ': ' . $ e [ 'message' ] ; throw new \ RuntimeException ( $ message ) ; } $ this -> dir = realpath ( $ dir ) ; return $ this ; }
|
Set the cache directory
|
60,021
|
protected function readAndVerify ( $ handle , $ file ) { $ content = fread ( $ handle , filesize ( $ file ) ) ; $ content = @ unserialize ( $ content ) ; if ( $ content && is_array ( $ content ) && time ( ) < $ content [ 0 ] ) { return $ content ; } else { return false ; } }
|
Read file by handle and verify if content is expired
|
60,022
|
protected function writeAndRelease ( $ handle , $ content , $ rewrite = false ) { $ rewrite && rewind ( $ handle ) && ftruncate ( $ handle , 0 ) ; $ result = fwrite ( $ handle , $ content ) ; flock ( $ handle , LOCK_UN ) ; fclose ( $ handle ) ; return ( bool ) $ result ; }
|
Write content release lock and close file
|
60,023
|
public function setValueRange ( $ minValue , $ maxValue ) { if ( preg_match ( '/^([1-9][0-9]*)|([0]{1})$/' , $ minValue ) !== 1 ) { throw new InvalidArgumentException ( 'Min value must contain only digits.' ) ; } if ( preg_match ( '/^[1-9][0-9]*$/' , $ maxValue ) !== 1 ) { throw new InvalidArgumentException ( 'Max value must start with a nonzero digit and contain only digits.' ) ; } if ( gmp_cmp ( $ maxValue , $ minValue ) < 1 ) { throw new InvalidArgumentException ( 'Max value must be greater than min value.' ) ; } $ this -> minValue = $ minValue ; $ this -> maxValue = $ maxValue ; $ this -> binSize = 2 ; $ span = gmp_init ( '4' , 10 ) ; $ multiplier = gmp_init ( '4' , 10 ) ; do { $ this -> binSize += 2 ; $ span = gmp_mul ( $ span , $ multiplier ) ; } while ( gmp_cmp ( $ span , $ this -> maxValue ) < 1 ) ; $ this -> decSize = strlen ( $ this -> maxValue ) ; $ this -> hexSize = $ this -> binSize / 4 ; $ this -> sideSize = ( int ) $ this -> binSize / 2 ; if ( $ this -> sideSize > $ this -> cipherLength ) { throw new LogicException ( sprintf ( 'Side size (%d bits) must be less or equal to cipher length (%d bits)' , $ this -> sideSize , $ this -> cipherLength ) ) ; } return $ this ; }
|
Set value range and pad sizes .
|
60,024
|
public function encrypt ( $ input , $ base = 10 , $ pad = false , $ password = null , $ iv = null ) { return $ this -> _encryptInternal ( $ input , $ base , $ pad , $ password , $ iv , true ) ; }
|
Encrypts input data . Acts as a public alias for _encryptInternal method .
|
60,025
|
private function _encryptInternal ( $ input , $ base , $ pad , $ password , $ iv , $ checkVal = false ) { $ this -> _validateInput ( $ input , $ base , $ checkVal ) ; $ this -> _validateIv ( $ iv ) ; $ hashPassword = $ this -> _hashPassword ( $ password ) ; $ roundKeys = $ this -> _roundKeys ( $ hashPassword , $ iv ) ; $ binary = $ this -> _convertToBin ( $ input , $ base ) ; for ( $ i = 1 ; $ i <= $ this -> rounds ; $ i ++ ) { $ left = substr ( $ binary , 0 , $ this -> sideSize ) ; $ right = substr ( $ binary , - 1 * $ this -> sideSize ) ; $ key = $ roundKeys [ $ i ] ; $ round = $ this -> _round ( $ right , $ key , $ hashPassword , $ iv ) ; $ newLeft = $ right ; $ newRight = $ this -> _binaryXor ( $ left , $ round ) ; $ binary = $ newLeft . $ newRight ; } $ output = $ this -> _convertFromBin ( $ binary , $ base , $ pad ) ; $ compare = DataConverter :: binToDec ( $ binary ) ; return ( gmp_cmp ( $ this -> minValue , $ compare ) > 0 || gmp_cmp ( $ compare , $ this -> maxValue ) > 0 ) ? $ this -> _encryptInternal ( $ output , $ base , $ pad , $ password , $ iv , false ) : $ output ; }
|
Encrypts input data .
|
60,026
|
private function _encrypt ( $ input , $ password , $ iv = null ) { return ( self :: $ allowedCiphers [ $ this -> cipher ] [ 'iv' ] ) ? openssl_encrypt ( $ input , $ this -> cipher , $ password , true , $ iv ) : openssl_encrypt ( $ input , $ this -> cipher , $ password , true ) ; }
|
Encrypt helper .
|
60,027
|
private function _round ( $ input , $ key , $ hashPassword , $ iv = null ) { $ bin = DataConverter :: rawToBin ( $ this -> _encrypt ( $ input . $ key , $ hashPassword , $ iv ) ) ; return substr ( $ bin , - 1 * $ this -> sideSize ) ; }
|
Round function helper .
|
60,028
|
private function _binaryXor ( $ left , $ round ) { $ xOr = gmp_xor ( gmp_init ( $ left , 2 ) , gmp_init ( $ round , 2 ) ) ; $ bin = gmp_strval ( $ xOr , 2 ) ; return str_pad ( $ bin , $ this -> sideSize , '0' , STR_PAD_LEFT ) ; }
|
Binary xor helper .
|
60,029
|
private function _convertToBin ( $ input , $ base ) { switch ( $ base ) { case 2 : return DataConverter :: pad ( $ input , $ this -> binSize ) ; case 10 : return DataConverter :: decToBin ( $ input , $ this -> binSize ) ; case 16 : return DataConverter :: hexToBin ( $ input , $ this -> binSize ) ; } }
|
Helper method converting input data to binary string .
|
60,030
|
private function _convertFromBin ( $ binary , $ base , $ pad ) { switch ( $ base ) { case 2 : return DataConverter :: pad ( $ binary , ( $ pad ? $ this -> binSize : 0 ) ) ; case 10 : return DataConverter :: binToDec ( $ binary , ( $ pad ? $ this -> decSize : 0 ) ) ; case 16 : return DataConverter :: binToHex ( $ binary , ( $ pad ? $ this -> hexSize : 0 ) ) ; } }
|
Helper method converting input data from binary string .
|
60,031
|
private function _validateInput ( $ input , $ base , $ checkDomain = false ) { if ( ! array_key_exists ( $ base , self :: $ allowedBases ) ) { throw new InvalidArgumentException ( sprintf ( 'Type must be one of "%s".' , implode ( ', ' , array_keys ( self :: $ allowedBases ) ) ) ) ; } if ( preg_match ( self :: $ allowedBases [ $ base ] , $ input ) !== 1 ) { throw new InvalidArgumentException ( sprintf ( 'Input data "%s" does not match pattern "%s".' , $ input , self :: $ allowedBases [ $ base ] ) ) ; } if ( $ checkDomain ) { $ compare = gmp_init ( $ input , $ base ) ; if ( gmp_cmp ( $ this -> minValue , $ compare ) > 0 || gmp_cmp ( $ compare , $ this -> maxValue ) > 0 ) { throw new InvalidArgumentException ( sprintf ( 'Input value "%d" is out of domain range "%d - %d".' , gmp_strval ( $ compare , 10 ) , $ this -> minValue , $ this -> maxValue ) ) ; } } }
|
Validates input data .
|
60,032
|
private function _validateIv ( $ iv = null ) { if ( self :: $ allowedCiphers [ $ this -> cipher ] [ 'iv' ] ) { $ this -> blockSize = openssl_cipher_iv_length ( $ this -> cipher ) ; $ ivLength = mb_strlen ( $ iv , '8bit' ) ; if ( $ ivLength !== $ this -> blockSize ) { throw new InvalidArgumentException ( sprintf ( 'Initialization vector of %d bytes is required for cipher "%s", %d given.' , $ this -> blockSize , $ this -> cipher , $ ivLength ) ) ; } } }
|
Validates initialization vector .
|
60,033
|
private function _hashPassword ( $ password = null ) { if ( null !== $ password ) { $ this -> password = md5 ( $ password ) ; } return $ this -> password ; }
|
Hashes the password .
|
60,034
|
private function _roundKeys ( $ hashPassword = null , $ iv = null ) { $ roundKeys = [ ] ; $ prevKey = $ this -> _encrypt ( $ this -> key , $ hashPassword , $ iv ) ; for ( $ i = 1 ; $ i <= $ this -> rounds ; $ i ++ ) { $ prevKey = $ this -> _encrypt ( $ prevKey , $ hashPassword , $ iv ) ; $ roundKeys [ $ i ] = substr ( DataConverter :: rawToBin ( $ prevKey ) , - 1 * $ this -> sideSize ) ; } return $ roundKeys ; }
|
Generates hash keys .
|
60,035
|
public function _output ( $ array_js = '' ) { if ( ! is_array ( $ array_js ) ) { $ array_js = array ( $ array_js ) ; } foreach ( $ array_js as $ js ) { $ this -> jquery_code_for_compile [ ] = "\t$js\n" ; } }
|
Outputs script directly
|
60,036
|
public function _add_event ( $ element , $ js , $ event , $ preventDefault = false , $ stopPropagation = false , $ immediatly = true ) { if ( is_array ( $ js ) ) { $ js = implode ( "\n\t\t" , $ js ) ; } if ( $ preventDefault === true ) { $ js = "event.preventDefault();\n" . $ js ; } if ( $ stopPropagation === true ) { $ js = "event.stopPropagation();\n" . $ js ; } if ( array_search ( $ event , $ this -> jquery_events ) === false ) $ event = "\n\t$(" . $ this -> _prep_element ( $ element ) . ").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n" ; else $ event = "\n\t$(" . $ this -> _prep_element ( $ element ) . ").{$event}(function(event){\n\t\t{$js}\n\t});\n" ; if ( $ immediatly ) $ this -> jquery_code_for_compile [ ] = $ event ; return $ event ; }
|
Constructs the syntax for an event and adds to into the array for compilation
|
60,037
|
public function _compile ( & $ view = NULL , $ view_var = 'script_foot' , $ script_tags = TRUE ) { $ ui = $ this -> ui ( ) ; if ( $ this -> ui ( ) != NULL ) { if ( $ ui -> isAutoCompile ( ) ) { $ ui -> compile ( true ) ; } } $ bootstrap = $ this -> bootstrap ( ) ; if ( $ this -> bootstrap ( ) != NULL ) { if ( $ bootstrap -> isAutoCompile ( ) ) { $ bootstrap -> compile ( true ) ; } } $ semantic = $ this -> semantic ( ) ; if ( $ semantic != NULL ) { if ( $ semantic -> isAutoCompile ( ) ) { $ semantic -> compile ( true ) ; } } $ external_scripts = implode ( '' , $ this -> jquery_code_for_load ) ; extract ( array ( 'library_src' => $ external_scripts ) ) ; if ( count ( $ this -> jquery_code_for_compile ) == 0 ) { return ; } $ script = '$(document).ready(function() {' . "\n" ; $ script .= implode ( '' , $ this -> jquery_code_for_compile ) ; $ script .= '});' ; $ this -> jquery_code_for_compile = array ( ) ; if ( $ this -> params [ "debug" ] == false ) { $ script = $ this -> minify ( $ script ) ; } $ output = ( $ script_tags === FALSE ) ? $ script : $ this -> inline ( $ script ) ; if ( $ view !== NULL ) { $ this -> jsUtils -> createScriptVariable ( $ view , $ view_var , $ output ) ; } return $ output ; }
|
As events are specified they are stored in an array This function compiles them all for output on a page
|
60,038
|
public static function bootstrap ( $ coverageEnabled , $ storageDirectory , $ phpunitConfigFilePath = null ) { Assert :: boolean ( $ coverageEnabled ) ; if ( ! $ coverageEnabled ) { return function ( ) { } ; } $ coverageGroup = isset ( $ _GET [ self :: COVERAGE_GROUP_KEY ] ) ? $ _GET [ self :: COVERAGE_GROUP_KEY ] : ( isset ( $ _COOKIE [ self :: COVERAGE_GROUP_KEY ] ) ? $ _COOKIE [ self :: COVERAGE_GROUP_KEY ] : null ) ; $ storageDirectory .= ( $ coverageGroup ? '/' . $ coverageGroup : '' ) ; if ( isset ( $ _GET [ self :: EXPORT_CODE_COVERAGE_KEY ] ) ) { header ( 'Content-Type: text/plain' ) ; echo self :: exportCoverageData ( $ storageDirectory ) ; exit ; } $ coverageId = isset ( $ _GET [ self :: COVERAGE_ID_KEY ] ) ? $ _GET [ self :: COVERAGE_ID_KEY ] : ( isset ( $ _COOKIE [ self :: COVERAGE_ID_KEY ] ) ? $ _COOKIE [ self :: COVERAGE_ID_KEY ] : 'live-coverage' ) ; return LiveCodeCoverage :: bootstrap ( isset ( $ _COOKIE [ self :: COLLECT_CODE_COVERAGE_KEY ] ) && ( bool ) $ _COOKIE [ self :: COLLECT_CODE_COVERAGE_KEY ] , $ storageDirectory , $ phpunitConfigFilePath , $ coverageId ) ; }
|
Enable remote code coverage .
|
60,039
|
public function _animate ( $ element = 'this' , $ params = array ( ) , $ speed = '' , $ extra = '' , $ immediatly = false ) { $ element = $ this -> _prep_element ( $ element ) ; $ speed = $ this -> _validate_speed ( $ speed ) ; $ animations = "\t\t\t" ; if ( is_array ( $ params ) ) { foreach ( $ params as $ param => $ value ) { $ animations .= $ param . ': \'' . $ value . '\', ' ; } } $ animations = substr ( $ animations , 0 , - 2 ) ; if ( $ speed != '' ) { $ speed = ', ' . $ speed ; } if ( $ extra != '' ) { $ extra = ', ' . $ extra ; } $ str = "$({$element}).animate({\n$animations\n\t\t}" . $ speed . $ extra . ");" ; if ( $ immediatly ) $ this -> jquery_code_for_compile [ ] = $ str ; return $ str ; }
|
Execute a jQuery animate action
|
60,040
|
public function _fadeIn ( $ element = 'this' , $ speed = '' , $ callback = '' , $ immediatly = false ) { $ element = $ this -> _prep_element ( $ element ) ; $ speed = $ this -> _validate_speed ( $ speed ) ; if ( $ callback != '' ) { $ callback = ", function(){\n{$callback}\n}" ; } $ str = "$({$element}).fadeIn({$speed}{$callback});" ; if ( $ immediatly ) $ this -> jquery_code_for_compile [ ] = $ str ; return $ str ; }
|
Execute a jQuery hide action
|
60,041
|
public function _toggle ( $ element = 'this' , $ immediatly = false ) { $ element = $ this -> _prep_element ( $ element ) ; $ str = "$({$element}).toggle();" ; if ( $ immediatly ) $ this -> jquery_code_for_compile [ ] = $ str ; return $ str ; }
|
Outputs a jQuery toggle event
|
60,042
|
public function _condition ( $ condition , $ jsCodeIfTrue , $ jsCodeIfFalse = null , $ immediatly = false ) { $ str = "if(" . $ condition . "){" . $ jsCodeIfTrue . "}" ; if ( isset ( $ jsCodeIfFalse ) ) { $ str .= "else{" . $ jsCodeIfFalse . "}" ; } if ( $ immediatly ) $ this -> jquery_code_for_compile [ ] = $ str ; return $ str ; }
|
Places a condition
|
60,043
|
public function filter ( $ filter ) { if ( is_array ( $ filter ) ) { $ filter = new GridFilter ( $ filter ) ; } if ( $ filter instanceof FilterSpecification ) { $ filter = new GridFilter ( $ filter -> asFilter ( ) ) ; } $ this -> filter = $ filter ; return $ this ; }
|
Set filter to the resource selecting
|
60,044
|
protected function getRelationships ( array $ item , array $ included ) { if ( ! isset ( $ item [ 'relationships' ] ) || ! is_array ( $ item [ 'relationships' ] ) ) { return [ ] ; } $ result = [ ] ; foreach ( $ item [ 'relationships' ] as $ relationKey => $ relationValue ) { foreach ( $ relationValue [ 'data' ] as $ relationData ) { if ( ! isset ( $ included [ $ relationData [ 'type' ] ] [ $ relationData [ 'id' ] ] ) ) { throw new EntityNotFoundException ( "Data for type[{$relationData['type']}] and id[{$relationData['id']}] was not found in includes" ) ; } $ result [ $ relationKey ] [ $ relationData [ 'id' ] ] = $ included [ $ relationData [ 'type' ] ] [ $ relationData [ 'id' ] ] ; } } return $ result ; }
|
Get relationships from array
|
60,045
|
public function drop ( $ table , $ ifExists = false ) { $ sql = 'DROP TABLE ' ; if ( $ ifExists ) { $ sql .= 'IF EXISTS ' ; } $ sql .= $ table ; $ this -> db -> executeUpdate ( $ sql ) ; return $ this ; }
|
Execute a drop table sql
|
60,046
|
public function decimal ( $ column , $ length = 10 , $ scale = 2 ) { return $ this -> addColumn ( $ column , self :: TYPE_DECIMAL , array ( 'length' => $ length , 'scale' => $ scale ) ) ; }
|
Add a decimal column
|
60,047
|
public function int ( $ column , $ length = null ) { return $ this -> addColumn ( $ column , self :: TYPE_INT , array ( 'length' => $ length ) ) ; }
|
Add a int column
|
60,048
|
public function tinyInt ( $ column , $ length = null ) { return $ this -> addColumn ( $ column , self :: TYPE_TINY_INT , array ( 'length' => $ length ) ) ; }
|
Add a tiny int column
|
60,049
|
public function smallInt ( $ column , $ length = null ) { return $ this -> addColumn ( $ column , self :: TYPE_SMALL_INT , array ( 'length' => $ length ) ) ; }
|
Add a small int column
|
60,050
|
public function id ( $ column = 'id' ) { $ this -> int ( $ column ) -> unsigned ( ) -> autoIncrement ( ) ; return $ this -> primary ( $ column ) ; }
|
Add a int auto increment id to table
|
60,051
|
public function rename ( $ from , $ to ) { $ sql = sprintf ( 'RENAME TABLE %s TO %s' , $ from , $ to ) ; $ this -> db -> executeUpdate ( $ sql ) ; return $ this ; }
|
Execute a rename table sql
|
60,052
|
public function findDistinctHosts ( ) { $ query = $ this -> entityManager -> createQuery ( 'SELECT DISTINCT r.host FROM Neos\RedirectHandler\DatabaseStorage\Domain\Model\Redirect r' ) ; return array_map ( function ( $ record ) { return $ record [ 'host' ] ; } , $ query -> getResult ( ) ) ; }
|
Return a list of all hosts
|
60,053
|
protected function iterate ( IterableResult $ iterator , callable $ callback = null ) { $ iteration = 0 ; foreach ( $ iterator as $ object ) { $ object = current ( $ object ) ; yield $ object ; if ( $ callback !== null ) { call_user_func ( $ callback , $ iteration , $ object ) ; } $ iteration ++ ; } }
|
Iterator over an IterableResult and return a Generator
|
60,054
|
public function set ( int $ userId , array $ factors , array $ context ) { $ uriAppend = 'set' ; $ params = [ 'userId' => $ userId , 'factors' => $ factors , 'context' => $ context , ] ; $ response = $ this -> handler -> handle ( 'POST' , $ params , $ uriAppend ) ; return $ this -> make ( $ response ) ; }
|
Set consumer factors for history and for current entity factors
|
60,055
|
public function authorize_url ( $ client_id , $ redirect_uri , $ scope = 'AdministerAccount' , $ state = false ) { $ qs = 'type=web_server' ; $ qs .= '&client_id=' . urlencode ( $ client_id ) ; $ qs .= '&redirect_uri=' . urlencode ( $ redirect_uri ) ; $ qs .= '&scope=' . urlencode ( $ scope ) ; if ( $ state ) $ qs .= '&state=' . urlencode ( $ state ) ; return self :: OAUTH_URL . '?' . $ qs ; }
|
Get the authorization URL for your application .
|
60,056
|
public function exchange_token ( $ client_id , $ client_secret , $ redirect_uri , $ code = '' ) { $ params = array ( 'grant_type' => 'authorization_code' , 'client_id' => $ client_id , 'client_secret' => $ client_secret , 'redirect_uri' => $ redirect_uri , 'code' => $ code ) ; return $ this -> _request ( 'oauth' , $ params , self :: OAUTH_TOKEN_URL ) ; }
|
Exchange a provided OAuth code for an OAuth access token expires in value and refresh token .
|
60,057
|
public function refresh_token ( ) { if ( ! isset ( $ this -> auth_details [ 'refresh_token' ] ) ) trigger_error ( 'Error refreshing token. There is no refresh token set on this object.' , E_USER_ERROR ) ; $ params = array ( 'grant_type' => 'refresh_token' , 'refresh_token' => $ this -> auth_details [ 'refresh_token' ] ) ; return $ this -> _request ( 'oauth' , $ params , self :: OAUTH_TOKEN_URL ) ; }
|
Refresh the current OAuth token using the current refresh token .
|
60,058
|
public function getInt ( $ name , $ min = null , $ max = null ) { $ value = ( int ) $ this ( $ name ) ; if ( ! is_null ( $ min ) && $ value < $ min ) { return $ min ; } elseif ( ! is_null ( $ max ) && $ value > $ max ) { return $ max ; } return $ value ; }
|
Returns a integer value in the specified range
|
60,059
|
public function getInArray ( $ name , array $ array ) { $ value = $ this -> get ( $ name ) ; return in_array ( $ value , $ array ) ? $ value : $ array [ key ( $ array ) ] ; }
|
Returns a parameter value in the specified array if not in returns the first element instead
|
60,060
|
public function set ( $ name , $ value = null ) { if ( ! is_array ( $ name ) ) { $ this -> data [ $ name ] = $ value ; } else { foreach ( $ name as $ key => $ value ) { $ this -> data [ $ key ] = $ value ; } } return $ this ; }
|
Set parameter value
|
60,061
|
public function has ( $ name ) { return isset ( $ this -> data [ $ name ] ) && ! in_array ( $ this -> data [ $ name ] , [ '' , null , false , array ( ) ] , true ) ; }
|
Check if the parameter has value
|
60,062
|
public function & offsetGet ( $ offset ) { if ( ! isset ( $ this -> data [ $ offset ] ) ) { $ this -> extraKeys [ $ offset ] = true ; } return $ this -> data [ $ offset ] ; }
|
Get the offset value
|
60,063
|
public function getHost ( ) { $ host = $ this -> getServer ( 'HTTP_HOST' ) ? : $ this -> getServer ( 'SERVER_NAME' ) ? : $ this -> getServer ( 'REMOTE_ADDR' ) ; return preg_replace ( '/:\d+$/' , '' , $ host ) ; }
|
Returns the request host
|
60,064
|
public function getBaseUrl ( ) { if ( $ this -> baseUrl === null ) { $ this -> setBaseUrl ( $ this -> detectBaseUrl ( ) ) ; } return $ this -> baseUrl ; }
|
Get the base URL .
|
60,065
|
public function getPathInfo ( ) { if ( $ this -> pathInfo === null ) { $ this -> pathInfo = $ this -> detectPathInfo ( ) ; } return $ this -> pathInfo ; }
|
Return request path info
|
60,066
|
public function getMethod ( ) { if ( null === $ this -> method ) { $ this -> method = $ this -> getServer ( 'REQUEST_METHOD' , 'GET' ) ; } return $ this -> method ; }
|
Returns the HTTP request method
|
60,067
|
public function getContent ( ) { if ( null === $ this -> content && $ this -> fromGlobal ) { $ this -> content = file_get_contents ( 'php://input' ) ; } return $ this -> content ; }
|
Returns the request message body
|
60,068
|
public function getHeaders ( ) { $ headers = array ( ) ; foreach ( $ this -> servers as $ name => $ value ) { if ( 0 === strpos ( $ name , 'HTTP_' ) ) { $ headers [ substr ( $ name , 5 ) ] = $ value ; } } return $ headers ; }
|
Returns the HTTP request headers
|
60,069
|
protected function detectPathInfo ( ) { $ uri = $ this -> getRequestUri ( ) ; $ pathInfo = '/' . trim ( substr ( $ uri , strlen ( $ this -> getBaseUrl ( ) ) ) , '/' ) ; if ( false !== $ pos = strpos ( $ pathInfo , '?' ) ) { $ pathInfo = substr ( $ pathInfo , 0 , $ pos ) ; } return $ pathInfo ; }
|
Detect the path info for the request
|
60,070
|
protected function removeExtraKeys ( ) { foreach ( $ this -> extraKeys as $ offset => $ value ) { if ( $ this -> data [ $ offset ] === null ) { unset ( $ this -> data [ $ offset ] ) ; } } $ this -> extraKeys = [ ] ; }
|
Removes extra keys in data
|
60,071
|
public function _click ( $ element = 'this' , $ js = array ( ) , $ ret_false = TRUE ) { if ( ! is_array ( $ js ) ) { $ js = array ( $ js ) ; } if ( $ ret_false ) { $ js [ ] = "return false;" ; } return $ this -> _add_event ( $ element , $ js , 'click' ) ; }
|
Outputs a jQuery click event
|
60,072
|
public function _hover ( $ element = 'this' , $ over , $ out ) { $ event = "\n\t$(" . $ this -> _prep_element ( $ element ) . ").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n" ; $ this -> jquery_code_for_compile [ ] = $ event ; return $ event ; }
|
Outputs a jQuery hover event
|
60,073
|
public function toOptions ( $ name ) { $ html = '' ; foreach ( $ this -> wei -> getConfig ( $ name ) as $ value => $ text ) { if ( is_array ( $ text ) ) { $ html .= '<optgroup label="' . $ value . '">' ; foreach ( $ text as $ v => $ t ) { $ html .= '<option value="' . $ v . '">' . $ t . '</option>' ; } $ html .= '</optgroup>' ; } else { $ html .= '<option value="' . $ value . '">' . $ text . '</option>' ; } } return $ html ; }
|
Convert configuration data to HTML select options
|
60,074
|
public function nextState ( $ currentState , $ inputChar ) { $ initialState = $ currentState ; while ( true ) { $ transitions = & $ this -> yesTransitions [ $ currentState ] ; if ( isset ( $ transitions [ $ inputChar ] ) ) { $ nextState = $ transitions [ $ inputChar ] ; if ( $ currentState !== $ initialState ) { $ this -> yesTransitions [ $ initialState ] [ $ inputChar ] = $ nextState ; } return $ nextState ; } if ( $ currentState === 0 ) { return 0 ; } $ currentState = $ this -> noTransitions [ $ currentState ] ; } }
|
Map the current state and input character to the next state .
|
60,075
|
public function searchIn ( $ text ) { if ( ! $ this -> searchKeywords || $ text === '' ) { return [ ] ; } $ state = 0 ; $ results = [ ] ; $ length = strlen ( $ text ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ ch = $ text [ $ i ] ; $ state = $ this -> nextState ( $ state , $ ch ) ; foreach ( $ this -> outputs [ $ state ] as $ match ) { $ offset = $ i - $ this -> searchKeywords [ $ match ] + 1 ; $ results [ ] = [ $ offset , $ match ] ; } } return $ results ; }
|
Locate the search keywords in some text .
|
60,076
|
protected function computeYesTransitions ( ) { $ this -> yesTransitions = [ [ ] ] ; $ this -> outputs = [ [ ] ] ; foreach ( $ this -> searchKeywords as $ keyword => $ length ) { $ state = 0 ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ ch = $ keyword [ $ i ] ; if ( ! empty ( $ this -> yesTransitions [ $ state ] [ $ ch ] ) ) { $ state = $ this -> yesTransitions [ $ state ] [ $ ch ] ; } else { $ this -> yesTransitions [ $ state ] [ $ ch ] = $ this -> numStates ; $ this -> yesTransitions [ ] = [ ] ; $ this -> outputs [ ] = [ ] ; $ state = $ this -> numStates ++ ; } } $ this -> outputs [ $ state ] [ ] = $ keyword ; } }
|
Get the state transitions which the string - matching automaton shall make as it advances through input text .
|
60,077
|
protected function computeNoTransitions ( ) { $ queue = [ ] ; $ this -> noTransitions = [ ] ; foreach ( $ this -> yesTransitions [ 0 ] as $ ch => $ toState ) { $ queue [ ] = $ toState ; $ this -> noTransitions [ $ toState ] = 0 ; } while ( true ) { $ fromState = array_shift ( $ queue ) ; if ( $ fromState === null ) { break ; } foreach ( $ this -> yesTransitions [ $ fromState ] as $ ch => $ toState ) { $ queue [ ] = $ toState ; $ state = $ this -> noTransitions [ $ fromState ] ; while ( $ state !== 0 && empty ( $ this -> yesTransitions [ $ state ] [ $ ch ] ) ) { $ state = $ this -> noTransitions [ $ state ] ; } if ( isset ( $ this -> yesTransitions [ $ state ] [ $ ch ] ) ) { $ noState = $ this -> yesTransitions [ $ state ] [ $ ch ] ; } else { $ noState = 0 ; } $ this -> noTransitions [ $ toState ] = $ noState ; $ this -> outputs [ $ toState ] = array_merge ( $ this -> outputs [ $ toState ] , $ this -> outputs [ $ noState ] ) ; } } }
|
Get the state transitions which the string - matching automaton shall make when a partial match proves false .
|
60,078
|
public function stopAndSave ( ) { $ this -> codeCoverage -> stop ( ) ; Storage :: storeCodeCoverage ( $ this -> codeCoverage , $ this -> storageDirectory , uniqid ( date ( 'YmdHis' ) , true ) ) ; }
|
Stop collecting code coverage data and save it .
|
60,079
|
public function get ( int $ id , $ params = [ ] ) { if ( $ this -> fields ) { $ params [ 'fields' ] = implode ( ',' , $ this -> fields ) ; } $ uriAppend = 'byId/' . $ id ; $ response = $ this -> handler -> handle ( 'GET' , false , $ uriAppend , $ params ) ; return $ this -> make ( $ response , false ) ; }
|
Get entity by id
|
60,080
|
public function detail ( int $ id ) { $ response = $ this -> handler -> handle ( 'GET' , false , 'detail/' . $ id ) ; return $ this -> make ( $ response , false ) ; }
|
Detail dealer information
|
60,081
|
public function detailWithAddresses ( $ id ) { $ dealer = $ this -> detail ( $ id ) ; if ( $ dealer -> dealersToAddresses ) { $ addressesId = array_map ( function ( $ value ) { return $ value [ 'addressId' ] ; } , $ dealer -> dealersToAddresses ) ; $ addresses = $ this -> client -> addresses ( ) -> ids ( array_values ( $ addressesId ) ) -> all ( ) ; $ dealer -> addresses = $ addresses ; } return $ dealer ; }
|
Detail dealer information with additional request to addresses
|
60,082
|
public function send ( $ content = null , $ status = null ) { if ( is_array ( $ content ) ) { return $ this -> json ( $ content ) -> send ( ) ; } elseif ( null !== $ content ) { $ this -> setContent ( $ content ) ; } if ( null !== $ status ) { $ this -> setStatusCode ( $ status ) ; } $ this -> beforeSend && call_user_func ( $ this -> beforeSend , $ this , $ content ) ; $ this -> sendHeader ( ) ; $ this -> sendContent ( ) ; $ this -> afterSend && call_user_func ( $ this -> afterSend , $ this ) ; return $ this ; }
|
Send response header and content
|
60,083
|
public function setStatusCode ( $ code , $ text = null ) { $ this -> statusCode = ( int ) $ code ; if ( $ text ) { $ this -> statusText = $ text ; } elseif ( isset ( $ this -> statusTexts [ $ code ] ) ) { $ this -> statusText = $ this -> statusTexts [ $ code ] ; } return $ this ; }
|
Set the header status code
|
60,084
|
public function setHeader ( $ name , $ values = null , $ replace = true ) { if ( is_array ( $ name ) ) { foreach ( $ name as $ key => $ value ) { $ this -> setHeader ( $ key , $ value ) ; } return $ this ; } $ values = ( array ) $ values ; if ( true === $ replace || ! isset ( $ this -> headers [ $ name ] ) ) { $ this -> headers [ $ name ] = $ values ; } else { $ this -> headers [ $ name ] = array_merge ( $ this -> headers [ $ name ] , $ values ) ; } return $ this ; }
|
Set the header string
|
60,085
|
public function getHeader ( $ name , $ default = null , $ first = true ) { if ( ! isset ( $ this -> headers [ $ name ] ) ) { return $ default ; } if ( is_array ( $ this -> headers [ $ name ] ) && $ first ) { return current ( $ this -> headers [ $ name ] ) ; } return $ this -> headers [ $ name ] ; }
|
Get the header string
|
60,086
|
public function sendHeader ( ) { $ file = $ line = null ; if ( $ this -> isHeaderSent ( $ file , $ line ) ) { if ( $ this -> wei -> has ( 'logger' ) ) { $ this -> logger -> debug ( sprintf ( 'Header has been at %s:%s' , $ file , $ line ) ) ; } return false ; } $ this -> sendRawHeader ( sprintf ( 'HTTP/%s %d %s' , $ this -> version , $ this -> statusCode , $ this -> statusText ) ) ; foreach ( $ this -> headers as $ name => $ values ) { foreach ( $ values as $ value ) { $ this -> sendRawHeader ( $ name . ': ' . $ value ) ; } } $ this -> sendCookie ( ) ; return true ; }
|
Send HTTP headers including HTTP status raw headers and cookies
|
60,087
|
public function isHeaderSent ( & $ file = null , & $ line = null ) { return $ this -> unitTest ? ( bool ) $ this -> sentHeaders : headers_sent ( $ file , $ line ) ; }
|
Checks if or where headers have been sent
|
60,088
|
public function getCookie ( $ key , $ default = null ) { return isset ( $ this -> cookies [ $ key ] ) ? $ this -> cookies [ $ key ] [ 'value' ] : $ default ; }
|
Get response cookie
|
60,089
|
public function getHeaderString ( ) { $ string = '' ; foreach ( $ this -> headers as $ name => $ values ) { foreach ( $ values as $ value ) { $ string .= $ name . ': ' . $ value . "\r\n" ; } } return $ string ; }
|
Returns response header as string
|
60,090
|
public function setRedirectView ( $ redirectView ) { if ( ! is_file ( $ redirectView ) ) { throw new \ RuntimeException ( sprintf ( 'Redirect view file "%s" not found' , $ redirectView ) ) ; } $ this -> redirectView = $ redirectView ; return $ this ; }
|
Set redirect view file
|
60,091
|
public function redirect ( $ url = null , $ statusCode = 302 , $ options = array ( ) ) { $ this -> setStatusCode ( $ statusCode ) ; $ this -> setOption ( $ options ) ; $ escapedUrl = htmlspecialchars ( $ url , ENT_QUOTES , 'UTF-8' ) ; $ wait = ( int ) $ this -> redirectWait ; if ( 0 === $ wait ) { $ this -> setHeader ( 'Location' , $ url ) ; } if ( $ this -> redirectView ) { ob_start ( ) ; require $ this -> redirectView ; $ content = ob_get_clean ( ) ; } else { $ content = sprintf ( '<!DOCTYPE html><html> <head> <meta charset="utf-8"> <meta http-equiv="refresh" content="%d;url=%2$s"> <title>Redirecting to %s</title> </head> <body> <h1>Redirecting to <a href="%2$s">%2$s</a></h1> </body></html>' , $ wait , $ escapedUrl ) ; } return $ this -> setContent ( $ content ) ; }
|
Send a redirect response
|
60,092
|
public function json ( $ data , $ jsonp = false ) { $ options = 0 ; defined ( 'JSON_UNESCAPED_UNICODE' ) && $ options = JSON_UNESCAPED_UNICODE ; $ content = json_encode ( $ data , $ options ) ; if ( $ jsonp && preg_match ( '/^[$A-Z_][0-9A-Z_$.]*$/i' , $ this -> request [ 'callback' ] ) === 1 ) { $ this -> setHeader ( 'Content-Type' , 'application/javascript' ) ; $ content = $ this -> request [ 'callback' ] . '(' . $ content . ')' ; } else { $ this -> setHeader ( 'Content-Type' , 'application/json' ) ; } return $ this -> setContent ( $ content ) ; }
|
Response JSON or JSONP format string
|
60,093
|
public function flush ( $ content = null ) { if ( function_exists ( 'apache_setenv' ) ) { apache_setenv ( 'no-gzip' , '1' ) ; } if ( ! headers_sent ( ) && extension_loaded ( 'zlib' ) ) { ini_set ( 'zlib.output_compression' , '0' ) ; } ob_implicit_flush ( ) ; $ this -> send ( $ content ) ; if ( $ length = ini_get ( 'output_buffering' ) ) { echo str_pad ( '' , $ length ) ; } while ( ob_get_level ( ) ) { ob_end_flush ( ) ; } return $ this ; }
|
Flushes content to browser immediately
|
60,094
|
public function download ( $ file = null , array $ downloadOptions = array ( ) ) { $ o = $ downloadOptions + $ this -> downloadOption ; if ( ! is_file ( $ file ) ) { throw new \ RuntimeException ( 'File not found' , 404 ) ; } $ name = $ o [ 'filename' ] ? : basename ( $ file ) ; $ name = rawurlencode ( $ name ) ; $ userAgent = $ this -> request -> getServer ( 'HTTP_USER_AGENT' ) ; if ( preg_match ( '/MSIE ([\w.]+)/' , $ userAgent ) ) { $ filename = '=' . $ name ; } else { $ filename = "*=UTF-8''" . $ name ; } $ this -> setHeader ( array ( 'Content-Description' => 'File Transfer' , 'Content-Type' => $ o [ 'type' ] , 'Content-Disposition' => $ o [ 'disposition' ] . ';filename' . $ filename , 'Content-Transfer-Encoding' => 'binary' , 'Expires' => '0' , 'Cache-Control' => 'must-revalidate' , 'Pragma' => 'public' , 'Content-Length' => filesize ( $ file ) , ) ) ; $ this -> send ( ) ; readfile ( $ file ) ; return $ this ; }
|
Send file download response
|
60,095
|
public function release ( $ key ) { if ( $ this -> cache -> remove ( $ key ) ) { if ( ( $ index = array_search ( $ key , $ this -> keys ) ) !== false ) { unset ( $ this -> keys [ $ index ] ) ; } return true ; } else { return false ; } }
|
Release a lock key
|
60,096
|
public function before ( $ to , $ element , $ immediatly = false ) { return $ this -> js -> _genericCallElement ( 'before' , $ to , $ element , $ immediatly ) ; }
|
Insert content specified by the parameter before each element in the set of matched elements
|
60,097
|
public function val ( $ element = 'this' , $ value = '' , $ immediatly = false ) { return $ this -> js -> _genericCallValue ( 'val' , $ element , $ value , $ immediatly ) ; }
|
Get or set the value of the first element in the set of matched elements or set one or more attributes for every matched element .
|
60,098
|
public function html ( $ element = 'this' , $ value = '' , $ immediatly = false ) { return $ this -> js -> _genericCallValue ( 'html' , $ element , $ value , $ immediatly ) ; }
|
Get or set the html of an attribute for the first element in the set of matched elements .
|
60,099
|
public function condition ( $ condition , $ jsCodeIfTrue , $ jsCodeIfFalse = null , $ immediatly = false ) { return $ this -> js -> _condition ( $ condition , $ jsCodeIfTrue , $ jsCodeIfFalse , $ immediatly ) ; }
|
Allows to attach a condition
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.