idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
17,000
protected function determineLocaleAndQuery ( $ locale , $ query ) { if ( is_null ( $ query ) ) { $ modelName = $ this -> getViewModelName ( ) ; $ query = with ( new $ modelName ) -> newQuery ( ) ; } if ( $ locale ) { $ query -> where ( 'locale' , $ locale ) ; } return $ query ; }
Determines the query and locale
17,001
protected function extractMetaData ( ResponseInterface $ response ) { $ headers = $ this -> findMetaHeaders ( $ response ) ; if ( ! count ( $ headers ) ) { return [ ] ; } $ metaData = [ ] ; foreach ( $ headers as $ header ) { $ metaData [ $ header ] = $ response -> getHeaderLine ( $ header ) ; } return $ metaData ; }
Extracts meta data from Object s response headers .
17,002
protected function findMetaHeaders ( ResponseInterface $ response ) { $ headerNames = array_keys ( $ response -> getHeaders ( ) ) ; $ metaType = $ this -> objectMetaType ( ) ; return array_filter ( $ headerNames , function ( $ header ) use ( $ metaType ) { return strpos ( $ header , 'X-' . $ metaType . '-Meta' ) !== false ; } ) ; }
Filters meta headers from response .
17,003
public function hasMeta ( $ name ) { $ meta = $ this -> objectData ( 'meta' , [ ] ) ; return isset ( $ meta [ $ this -> sanitizeMetaName ( $ name ) ] ) ; }
Checks if given meta data exists .
17,004
public function getMeta ( $ name ) { if ( ! $ this -> hasMeta ( $ name ) ) { throw new InvalidArgumentException ( 'Meta data with name "' . $ name . '" does not exists.' ) ; } $ meta = $ this -> objectData ( 'meta' , [ ] ) ; return $ meta [ $ this -> sanitizeMetaName ( $ name ) ] ; }
Returns meta data .
17,005
public function setMeta ( array $ meta ) { $ headers = [ ] ; $ metaType = $ this -> objectMetaType ( ) ; foreach ( $ meta as $ name => $ value ) { $ key = str_replace ( 'X-' . $ metaType . '-Meta-' , '' , $ name ) ; $ headers [ 'X-' . $ metaType . '-Meta-' . $ key ] = $ value ; } $ response = $ this -> apiClient ( ) -> request ( 'POST' , $ this -> absolutePath ( ) , [ 'headers' => $ headers ] ) ; if ( $ response -> getStatusCode ( ) !== 202 ) { throw new ApiRequestFailedException ( 'Unable to update container meta data.' , $ response -> getStatusCode ( ) ) ; } return true ; }
Updates object meta data .
17,006
public function getContext ( $ options = [ ] ) { $ url = $ this -> getBaseURI ( ) ; if ( count ( $ options ) > 0 ) { $ prefix = ( $ this -> _type ) ? "&" : "?" ; $ url .= $ prefix . urldecode ( http_build_query ( $ options ) ) ; } return $ this -> _orion -> get ( $ url ) ; }
Executes OPERATIONS IN THE NGSIv2 RC 2016 . 05
17,007
public function update ( $ subscription ) { if ( ! isset ( $ this -> _id ) || null == $ this -> _id ) { throw new \ Exception ( "You must especify an Id to perform subscription updates" ) ; } if ( $ subscription instanceof SubscriptionFactory ) { $ context = new ContextFactory ( ( array ) $ subscription -> get ( ) ) ; } elseif ( is_array ( $ subscription ) || is_object ( $ subscription ) ) { $ context = new ContextFactory ( ( array ) $ subscription ) ; } return $ this -> _orion -> patch ( $ this -> getBaseURI ( ) , $ context ) ; }
Update a subscription you can pass a simple array chain in subscription know format or you can send a instance of SubscriptionFactory
17,008
public static function create ( ) { if ( function_exists ( 'com_create_guid' ) ) { return com_create_guid ( ) ; } mt_srand ( ( double ) microtime ( ) * 10000 ) ; $ charid = strtoupper ( md5 ( uniqid ( rand ( ) , true ) ) ) ; $ uuid = join ( '-' , array ( substr ( $ charid , 0 , 8 ) , substr ( $ charid , 8 , 4 ) , substr ( $ charid , 12 , 4 ) , substr ( $ charid , 16 , 4 ) , substr ( $ charid , 20 , 12 ) , ) ) ; return $ uuid ; }
Create UUID v4 string
17,009
public static function getLanguageURL ( $ language ) { $ dir = ObjectHelper :: getDirectory ( JQueryDataTablesBundle :: class ) ; $ dir .= "/Resources/public/datatables-i18n/%language%.json" ; $ uri = "/bundles/jquerydatatables/datatables-i18n/%language%.json" ; $ url = StringHelper :: replace ( $ uri , [ "%language%" ] , [ $ language ] ) ; $ file = StringHelper :: replace ( $ dir , [ "%language%" ] , [ $ language ] ) ; if ( false === file_exists ( $ file ) ) { throw new FileNotFoundException ( null , 500 , null , $ url ) ; } return $ url ; }
Get a language URL .
17,010
public static function getOptions ( DataTablesWrapperInterface $ dtWrapper ) { $ output = [ ] ; if ( null !== $ dtWrapper -> getOptions ( ) ) { $ output = $ dtWrapper -> getOptions ( ) -> getOptions ( ) ; } $ output [ "ajax" ] = [ ] ; $ output [ "ajax" ] [ "type" ] = $ dtWrapper -> getMethod ( ) ; $ output [ "ajax" ] [ "url" ] = $ dtWrapper -> getUrl ( ) ; $ output [ "columns" ] = [ ] ; $ output [ "order" ] = $ dtWrapper -> getOrder ( ) ; $ output [ "processing" ] = $ dtWrapper -> getProcessing ( ) ; $ output [ "serverSide" ] = $ dtWrapper -> getServerSide ( ) ; foreach ( $ dtWrapper -> getColumns ( ) as $ current ) { $ output [ "columns" ] [ ] = DataTablesNormalizer :: normalizeColumn ( $ current ) ; } return $ output ; }
Get the options .
17,011
protected function fileData ( $ key , $ default = null ) { $ this -> guardDeletedFile ( ) ; return isset ( $ this -> data [ $ key ] ) ? $ this -> data [ $ key ] : $ default ; }
Returns specific file data .
17,012
protected function absolutePath ( $ path = '' ) { if ( ! $ path ) { $ path = $ this -> path ( ) ; } return '/' . $ this -> container ( ) . ( $ path ? '/' . ltrim ( $ path , '/' ) : '' ) ; }
Absolute path to file from storage root .
17,013
public function read ( ) { $ response = $ this -> api -> request ( 'GET' , $ this -> absolutePath ( ) ) ; return ( string ) $ response -> getBody ( ) ; }
Reads file contents .
17,014
public function readStream ( $ psr7Stream = false ) { $ response = $ this -> api -> request ( 'GET' , $ this -> absolutePath ( ) ) ; if ( $ psr7Stream ) { return $ response -> getBody ( ) ; } return StreamWrapper :: getResource ( $ response -> getBody ( ) ) ; }
Reads file contents as stream .
17,015
public function rename ( $ name ) { $ this -> guardDeletedFile ( ) ; if ( count ( explode ( '/' , $ name ) ) > 1 ) { throw new InvalidArgumentException ( 'File name can not contain "/" character.' ) ; } $ destination = $ this -> directory ( ) . '/' . $ name ; $ response = $ this -> api -> request ( 'PUT' , $ this -> absolutePath ( $ destination ) , [ 'headers' => [ 'X-Copy-From' => $ this -> absolutePath ( ) , 'Content-Length' => 0 , ] , ] ) ; if ( $ response -> getStatusCode ( ) !== 201 ) { throw new ApiRequestFailedException ( 'Unable to rename file from "' . $ this -> name ( ) . '" to "' . $ name . '" (path: "' . $ this -> directory ( ) . '").' , $ response -> getStatusCode ( ) ) ; } $ this -> delete ( ) ; $ this -> deleted = false ; return $ this -> data [ 'name' ] = $ destination ; }
Rename file . New file name must be provided without path .
17,016
public function copy ( $ destination , $ destinationContainer = null ) { $ this -> guardDeletedFile ( ) ; if ( is_null ( $ destinationContainer ) ) { $ destinationContainer = $ this -> container ( ) ; } $ fullDestination = '/' . $ destinationContainer . '/' . ltrim ( $ destination , '/' ) ; $ response = $ this -> api -> request ( 'COPY' , $ this -> absolutePath ( ) , [ 'headers' => [ 'Destination' => $ fullDestination , ] , ] ) ; if ( $ response -> getStatusCode ( ) !== 201 ) { throw new ApiRequestFailedException ( 'Unable to copy file from "' . $ this -> path ( ) . '" to "' . $ destination . '".' , $ response -> getStatusCode ( ) ) ; } return $ fullDestination ; }
Copy file to given destination .
17,017
public function delete ( ) { $ this -> guardDeletedFile ( ) ; $ response = $ this -> api -> request ( 'DELETE' , $ this -> absolutePath ( ) ) ; if ( $ response -> getStatusCode ( ) !== 204 ) { throw new ApiRequestFailedException ( 'Unable to delete file "' . $ this -> path ( ) . '".' , $ response -> getStatusCode ( ) ) ; } $ this -> deleted = true ; return true ; }
Deletes file .
17,018
public function jsonSerialize ( ) { return [ 'name' => $ this -> name ( ) , 'path' => $ this -> path ( ) , 'directory' => $ this -> directory ( ) , 'container' => $ this -> container ( ) , 'size' => $ this -> size ( ) , 'content_type' => $ this -> contentType ( ) , 'last_modified' => $ this -> lastModifiedAt ( ) , 'etag' => $ this -> etag ( ) , ] ; }
JSON representation of file .
17,019
public function getResponseParam ( $ param ) { if ( isset ( $ this -> notifyParams [ $ param ] ) ) { return $ this -> notifyParams [ $ param ] ; } return NULL ; }
returns the data from the given parameter
17,020
public function parseNotification ( $ params ) { $ Config = GiroCheckout_SDK_Config :: getInstance ( ) ; if ( $ Config -> getConfig ( 'DEBUG_MODE' ) ) { GiroCheckout_SDK_Debug_helper :: getInstance ( ) -> logNotificationInput ( $ params ) ; } if ( ! is_array ( $ params ) || empty ( $ params ) ) { throw new GiroCheckout_SDK_Exception_helper ( 'no data given' ) ; } try { $ this -> notifyParams = $ this -> requestMethod -> checkNotification ( $ params ) ; if ( $ Config -> getConfig ( 'DEBUG_MODE' ) ) { GiroCheckout_SDK_Debug_helper :: getInstance ( ) -> logNotificationParams ( $ this -> notifyParams ) ; } if ( ! $ this -> checkHash ( ) ) { throw new GiroCheckout_SDK_Exception_helper ( 'hash mismatch' ) ; } } catch ( \ Exception $ e ) { throw new GiroCheckout_SDK_Exception_helper ( 'Failure: ' . $ e -> getMessage ( ) . "\n" ) ; } return TRUE ; }
parses the given notification array
17,021
public function checkHash ( ) { $ string = '' ; $ hashFieldName = $ this -> requestMethod -> getNotifyHashName ( ) ; foreach ( $ this -> notifyParams as $ k => $ v ) { if ( $ k !== $ hashFieldName ) { $ string .= $ v ; } } if ( $ this -> notifyParams [ $ hashFieldName ] === hash_hmac ( 'md5' , $ string , $ this -> secret ) ) { return TRUE ; } return FALSE ; }
validates the submitted hash by comparing to a self generated Hash
17,022
public function avsSuccessful ( ) { if ( $ this -> requestMethod -> getAVSSuccessfulCode ( ) != NULL ) { return $ this -> requestMethod -> getAVSSuccessfulCode ( ) == $ this -> notifyParams [ 'gcResultAVS' ] ; } return FALSE ; }
returns true if the age verification was successful
17,023
public function sendOkStatus ( ) { $ Config = GiroCheckout_SDK_Config :: getInstance ( ) ; if ( $ Config -> getConfig ( 'DEBUG_MODE' ) ) { GiroCheckout_SDK_Debug_helper :: getInstance ( ) -> logNotificationOutput ( 'sendOkStatus' ) ; } header ( 'HTTP/1.1 200 OK' ) ; }
sends header with 200 OK status
17,024
public function sendBadRequestStatus ( ) { $ Config = GiroCheckout_SDK_Config :: getInstance ( ) ; if ( $ Config -> getConfig ( 'DEBUG_MODE' ) ) { GiroCheckout_SDK_Debug_helper :: getInstance ( ) -> logNotificationOutput ( 'sendBadRequestStatus' ) ; } header ( 'HTTP/1.1 400 Bad Request' ) ; }
sends header with 400 Bad Request status
17,025
public function sendServiceUnavailableStatus ( ) { $ Config = GiroCheckout_SDK_Config :: getInstance ( ) ; if ( $ Config -> getConfig ( 'DEBUG_MODE' ) ) { GiroCheckout_SDK_Debug_helper :: getInstance ( ) -> logNotificationOutput ( 'sendServiceUnavailableStatus' ) ; } header ( 'HTTP/1.1 503 Service Unavailable' ) ; }
sends header with 503 Service Unavailable status
17,026
public function sendOtherStatus ( ) { $ Config = GiroCheckout_SDK_Config :: getInstance ( ) ; if ( $ Config -> getConfig ( 'DEBUG_MODE' ) ) { GiroCheckout_SDK_Debug_helper :: getInstance ( ) -> logNotificationOutput ( 'sendOtherStatus' ) ; } header ( 'HTTP/1.1 404 Not Found' ) ; }
sends header with 404 Not Found status
17,027
public function getNotifyResponseStringJson ( ) { $ response [ 'Result' ] = $ this -> notifyResponse [ 'Result' ] ; $ response [ 'ErrorMessage' ] = $ this -> notifyResponse [ 'ErrorMessage' ] ; $ response [ 'OrderId' ] = $ this -> notifyResponse [ 'OrderId' ] ; $ response [ 'CustomerId' ] = $ this -> notifyResponse [ 'CustomerId' ] ; $ response [ 'MailSent' ] = $ this -> notifyResponse [ 'MailSent' ] ; $ response [ 'Timestamp' ] = time ( ) ; return json_encode ( $ this -> notifyResponse ) ; }
returns a JSON string to be printed to the notification output
17,028
public function getLoggedInUser ( $ mapperName = \ Tx_Oelib_Mapper_FrontEndUser :: class ) { if ( $ mapperName === '' ) { throw new \ InvalidArgumentException ( '$mapperName must not be empty.' , 1331488730 ) ; } if ( ! $ this -> isLoggedIn ( ) ) { return null ; } if ( $ this -> loggedInUser !== null ) { $ user = $ this -> loggedInUser ; } else { $ mapper = \ Tx_Oelib_MapperRegistry :: get ( $ mapperName ) ; $ user = $ mapper -> find ( $ this -> getFrontEndController ( ) -> fe_user -> user [ 'uid' ] ) ; } return $ user ; }
Gets the currently logged - in front - end user .
17,029
public function getSettingOrThrow ( $ key ) { if ( ! isset ( $ this -> data [ $ key ] ) ) { throw new UnknownSettingException ( $ this -> id , $ key ) ; } return $ this -> data [ $ key ] ; }
Get the value of a setting in the initializer configuration . If that setting is not found an exception will be thrown .
17,030
public function getSetting ( $ key , $ defaultValue ) { if ( ! isset ( $ this -> data [ $ key ] ) ) { return $ defaultValue ; } return $ this -> data [ $ key ] ; }
Get the value of a setting in the initializer configuration . If that setting is not found return the provided default value .
17,031
public function init ( $ configuration = null ) { if ( $ this -> isInitialized ) { return ; } parent :: __construct ( ) ; $ this -> initializeConfiguration ( $ configuration ) ; $ this -> ensureContentObject ( ) ; if ( $ this -> extKey !== '' ) { $ this -> pi_setPiVarDefaults ( ) ; $ this -> pi_loadLL ( ) ; $ this -> initializeConfigurationCheck ( ) ; } $ this -> isInitialized = true ; }
Initializes the FE plugin stuff and reads the configuration .
17,032
private function getConfValue ( $ fieldName , $ sheet = 'sDEF' , $ isFileName = false , $ ignoreFlexform = false ) { $ flexformsValue = '' ; if ( ! $ ignoreFlexform ) { $ flexformsValue = $ this -> pi_getFFvalue ( $ this -> cObj -> data [ 'pi_flexform' ] , $ fieldName , $ sheet ) ; } if ( $ isFileName && $ flexformsValue !== null && $ flexformsValue !== '' ) { $ flexformsValue = $ this -> addPathToFileName ( $ flexformsValue ) ; } $ confValue = isset ( $ this -> conf [ $ fieldName ] ) ? $ this -> conf [ $ fieldName ] : '' ; return $ flexformsValue ? : $ confValue ; }
Gets a value from flexforms or TS setup . The priority lies on flexforms ; if nothing is found there the value from TS setup is returned . If there is no field with that name in TS setup an empty string is returned .
17,033
private function addPathToFileName ( $ fileName , $ path = '' ) { if ( empty ( $ path ) ) { $ path = 'uploads/tx_' . $ this -> extKey . '/' ; } return $ path . $ fileName ; }
Adds a path in front of the file name . This is used for files that are selected in the Flexform of the front end plugin .
17,034
public function getConfValueString ( $ fieldName , $ sheet = 'sDEF' , $ isFileName = false , $ ignoreFlexform = false ) { return trim ( $ this -> getConfValue ( $ fieldName , $ sheet , $ isFileName , $ ignoreFlexform ) ) ; }
Gets a trimmed string value from flexforms or TS setup . The priority lies on flexforms ; if nothing is found there the value from TS setup is returned . If there is no field with that name in TS setup an empty string is returned .
17,035
public function hasConfValueString ( $ fieldName , $ sheet = 'sDEF' , $ ignoreFlexform = false ) { return $ this -> getConfValueString ( $ fieldName , $ sheet , false , $ ignoreFlexform ) !== '' ; }
Checks whether a string value from flexforms or TS setup is set . The priority lies on flexforms ; if nothing is found there the value from TS setup is checked . If there is no field with that name in TS setup FALSE is returned .
17,036
public static function setCachedConfigurationValue ( $ key , $ value ) { $ pageUid = \ Tx_Oelib_PageFinder :: getInstance ( ) -> getPageUid ( ) ; if ( ! isset ( self :: $ cachedConfigurations [ $ pageUid ] ) ) { self :: $ cachedConfigurations [ $ pageUid ] = [ ] ; } self :: $ cachedConfigurations [ $ pageUid ] [ $ key ] = $ value ; }
Sets a cached configuration value that will be used when a new instance is created .
17,037
public function setLabels ( ) { $ template = $ this -> getTemplate ( ) ; try { $ labels = $ template -> getLabelMarkerNames ( ) ; } catch ( Exception $ exception ) { $ labels = [ ] ; } foreach ( $ labels as $ label ) { $ template -> setMarker ( $ label , $ this -> translate ( $ label ) ) ; } }
Writes all localized labels for the current template into their corresponding template markers .
17,038
protected function ensureIntegerArrayValues ( array $ keys ) { if ( empty ( $ keys ) ) { return ; } foreach ( $ keys as $ key ) { if ( ! isset ( $ this -> piVars [ $ key ] ) || ! is_array ( $ this -> piVars [ $ key ] ) ) { continue ; } foreach ( $ this -> piVars [ $ key ] as $ innerKey => $ value ) { $ integerValue = ( int ) $ value ; if ( $ integerValue === 0 ) { unset ( $ this -> piVars [ $ key ] [ $ innerKey ] ) ; } else { $ this -> piVars [ $ key ] [ $ innerKey ] = $ integerValue ; } } } }
Ensures that all values in the given array are cast to ints and removes empty or invalid values .
17,039
private function getListViewConfigurationValue ( $ fieldName ) { if ( empty ( $ fieldName ) ) { throw new \ InvalidArgumentException ( '$fieldName must not be empty.' , 1331489528 ) ; } if ( ! isset ( $ this -> conf [ 'listView.' ] ) || ! isset ( $ this -> conf [ 'listView.' ] [ $ fieldName ] ) ) { return '' ; } return $ this -> conf [ 'listView.' ] [ $ fieldName ] ; }
Extracts a value within listView .
17,040
public static function getHMACMD5Hash ( $ password , $ data ) { $ dataString = implode ( '' , $ data ) ; return self :: getHMACMD5HashString ( $ password , $ dataString ) ; }
Returns a HMAC Hash with md5 encryption by using a secret and an array
17,041
public static function getHMACMD5HashString ( $ password , $ data ) { if ( function_exists ( 'hash_hmac' ) ) { return hash_hmac ( 'MD5' , $ data , $ password ) ; } else { return self :: hmacFallbackMD5 ( $ data , $ password ) ; } }
Returns a HMAC Hash with md5 encryption by using a secret and a string
17,042
protected function generateCacheTags ( $ node ) { $ this -> tagsToFlush [ ContentCache :: TAG_EVERYTHING ] = 'which were tagged with "Everything".' ; if ( empty ( $ this -> workspacesToFlush [ $ node -> getWorkspace ( ) -> getName ( ) ] ) ) { $ this -> resolveWorkspaceChain ( $ node -> getWorkspace ( ) ) ; } if ( ! array_key_exists ( $ node -> getWorkspace ( ) -> getName ( ) , $ this -> workspacesToFlush ) ) { return ; } $ nodeIdentifier = $ node -> getIdentifier ( ) ; foreach ( $ this -> workspacesToFlush [ $ node -> getWorkspace ( ) -> getName ( ) ] as $ workspaceName => $ workspaceHash ) { $ this -> generateCacheTagsForNodeIdentifier ( $ workspaceHash . '_' . $ nodeIdentifier ) ; $ this -> generateCacheTagsForNodeType ( $ node -> getNodeType ( ) -> getName ( ) , $ nodeIdentifier , $ workspaceHash ) ; $ nodeInWorkspace = $ node ; while ( $ nodeInWorkspace -> getDepth ( ) > 1 ) { $ nodeInWorkspace = $ nodeInWorkspace -> getParent ( ) ; if ( $ nodeInWorkspace === null ) { break ; } $ tagName = 'DescendantOf_' . $ workspaceHash . '_' . $ nodeInWorkspace -> getIdentifier ( ) ; $ this -> tagsToFlush [ $ tagName ] = sprintf ( 'which were tagged with "%s" because node "%s" has changed.' , $ tagName , $ node -> getPath ( ) ) ; } } if ( $ node instanceof NodeInterface && $ node -> getContext ( ) instanceof ContentContext ) { $ site = $ node -> getContext ( ) -> getCurrentSite ( ) ; if ( $ site -> hasActiveDomains ( ) ) { $ domains = $ site -> getActiveDomains ( ) -> map ( function ( Domain $ domain ) { return $ domain -> getHostname ( ) ; } ) -> toArray ( ) ; $ this -> domainsToFlush = array_unique ( array_merge ( $ this -> domainsToFlush , $ domains ) ) ; } } }
Generates cache tags to be flushed for a node which is flushed on shutdown .
17,043
public function getMarker ( $ markerName ) { $ unifiedMarkerName = $ this -> createMarkerName ( $ markerName ) ; if ( ! isset ( $ this -> markers [ $ unifiedMarkerName ] ) ) { return '' ; } return $ this -> markers [ $ unifiedMarkerName ] ; }
Gets a marker s content .
17,044
public function isSubpartVisible ( $ subpartName ) { if ( $ subpartName === '' ) { return false ; } return isset ( $ this -> subparts [ $ subpartName ] ) && ! isset ( $ this -> subpartsToHide [ $ subpartName ] ) ; }
Checks whether a subpart is visible .
17,045
protected function replaceSubparts ( $ templateCode ) { $ template = $ this ; return preg_replace_callback ( self :: SUBPART_PATTERN , function ( array $ matches ) use ( $ template ) { return $ template -> getSubpart ( $ matches [ 1 ] ) ; } , $ templateCode ) ; }
Recursively replaces subparts with their contents .
17,046
public function attachTrackerView ( $ view ) { if ( ! $ this -> trackerViews -> contains ( $ view -> getKey ( ) ) ) { return $ this -> trackerViews ( ) -> attach ( $ view ) ; } }
Attaches a tracker view
17,047
public static function implodeSlugs ( $ glue , $ terms ) { if ( $ terms == null || empty ( $ terms ) || is_wp_error ( $ terms ) ) return '' ; $ tokens = array ( ) ; foreach ( $ terms as $ t ) { $ tokens [ ] = $ t -> slug ; } return implode ( $ glue , $ tokens ) ; }
Implode the slugs of the provided terms
17,048
public static function implodeNames ( $ glue , $ terms ) { if ( $ terms == null || empty ( $ terms ) || is_wp_error ( $ terms ) ) return '' ; $ tokens = array ( ) ; foreach ( $ terms as $ t ) { $ tokens [ ] = $ t -> name ; } return implode ( $ glue , $ tokens ) ; }
Implode the names of the provided terms
17,049
protected function get ( $ key ) { $ this -> loadConfigurationLazily ( ) ; if ( $ this -> hasConfigurationValue ( $ key ) ) { $ result = $ this -> configuration [ $ key ] ; } else { $ result = '' ; } return $ result ; }
Returns a string configuration value .
17,050
public function clearCommand ( $ domain = null , $ contentType = null ) { $ this -> varnishBanService -> banAll ( $ domain , $ contentType ) ; }
Clear all cache in Varnish for a optionally given domain & content type
17,051
protected static function copyParameterBag ( ParameterBag $ src , ParameterBag $ dst ) { foreach ( $ src -> keys ( ) as $ current ) { if ( true === in_array ( $ current , DataTablesEnumerator :: enumParameters ( ) ) ) { continue ; } $ dst -> set ( $ current , $ src -> get ( $ current ) ) ; } }
Copy a parameter bag .
17,052
protected static function isValidRawColumn ( array $ rawColumn ) { if ( false === array_key_exists ( DataTablesColumnInterface :: DATATABLES_PARAMETER_DATA , $ rawColumn ) ) { return false ; } if ( false === array_key_exists ( DataTablesColumnInterface :: DATATABLES_PARAMETER_NAME , $ rawColumn ) ) { return false ; } return true ; }
Determines if a raw column is valid .
17,053
protected static function isValidRawOrder ( array $ rawOrder ) { if ( false === array_key_exists ( DataTablesOrderInterface :: DATATABLES_PARAMETER_COLUMN , $ rawOrder ) ) { return false ; } if ( false === array_key_exists ( DataTablesOrderInterface :: DATATABLES_PARAMETER_DIR , $ rawOrder ) ) { return false ; } return true ; }
Determines if a raw order is valid .
17,054
protected static function isValidRawSearch ( array $ rawSearch ) { if ( false === array_key_exists ( DataTablesSearchInterface :: DATATABLES_PARAMETER_REGEX , $ rawSearch ) ) { return false ; } if ( false === array_key_exists ( DataTablesSearchInterface :: DATATABLES_PARAMETER_VALUE , $ rawSearch ) ) { return false ; } return true ; }
Determines if a raw search is valid .
17,055
public static function newColumn ( $ data , $ name , $ cellType = DataTablesColumnInterface :: DATATABLES_CELL_TYPE_TD ) { $ dtColumn = new DataTablesColumn ( ) ; $ dtColumn -> getMapping ( ) -> setColumn ( $ data ) ; $ dtColumn -> setCellType ( $ cellType ) ; $ dtColumn -> setData ( $ data ) ; $ dtColumn -> setName ( $ name ) ; $ dtColumn -> setTitle ( $ name ) ; return $ dtColumn ; }
Create a new column instance .
17,056
public static function newWrapper ( $ url , DataTablesProviderInterface $ provider , UserInterface $ user = null ) { $ dtWrapper = new DataTablesWrapper ( ) ; $ dtWrapper -> getMapping ( ) -> setPrefix ( $ provider -> getPrefix ( ) ) ; $ dtWrapper -> setMethod ( $ provider -> getMethod ( ) ) ; $ dtWrapper -> setProvider ( $ provider ) ; $ dtWrapper -> setUser ( $ user ) ; $ dtWrapper -> setUrl ( $ url ) ; return $ dtWrapper ; }
Create a new wrapper .
17,057
protected static function parseColumn ( array $ rawColumn , DataTablesWrapperInterface $ wrapper ) { if ( false === static :: isValidRawColumn ( $ rawColumn ) ) { return null ; } $ dtColumn = $ wrapper -> getColumn ( $ rawColumn [ DataTablesColumnInterface :: DATATABLES_PARAMETER_DATA ] ) ; if ( null === $ dtColumn ) { return null ; } if ( $ dtColumn -> getName ( ) !== $ rawColumn [ DataTablesColumnInterface :: DATATABLES_PARAMETER_NAME ] ) { return null ; } if ( false === $ dtColumn -> getSearchable ( ) ) { $ dtColumn -> setSearch ( static :: parseSearch ( [ ] ) ) ; return $ dtColumn ; } $ dtColumn -> setSearch ( static :: parseSearch ( $ rawColumn [ DataTablesColumnInterface :: DATATABLES_PARAMETER_SEARCH ] ) ) ; return $ dtColumn ; }
Parse a raw column .
17,058
protected static function parseColumns ( array $ rawColumns , DataTablesWrapperInterface $ wrapper ) { $ dtColumns = [ ] ; foreach ( $ rawColumns as $ current ) { $ dtColumn = static :: parseColumn ( $ current , $ wrapper ) ; if ( null === $ dtColumn ) { continue ; } $ dtColumns [ ] = $ dtColumn ; } return $ dtColumns ; }
Parse a raw columns .
17,059
protected static function parseOrder ( array $ rawOrder ) { $ dtOrder = new DataTablesOrder ( ) ; if ( false === static :: isValidRawOrder ( $ rawOrder ) ) { return $ dtOrder ; } $ dtOrder -> setColumn ( intval ( $ rawOrder [ DataTablesOrderInterface :: DATATABLES_PARAMETER_COLUMN ] ) ) ; $ dtOrder -> setDir ( $ rawOrder [ DataTablesOrderInterface :: DATATABLES_PARAMETER_DIR ] ) ; return $ dtOrder ; }
Parse a raw order .
17,060
protected static function parseOrders ( array $ rawOrders ) { $ dtOrders = [ ] ; foreach ( $ rawOrders as $ current ) { $ dtOrders [ ] = static :: parseOrder ( $ current ) ; } return $ dtOrders ; }
Parse raw orders .
17,061
protected static function parseSearch ( array $ rawSearch ) { $ dtSearch = new DataTablesSearch ( ) ; if ( false === static :: isValidRawSearch ( $ rawSearch ) ) { return $ dtSearch ; } $ dtSearch -> setRegex ( BooleanHelper :: parseString ( $ rawSearch [ DataTablesSearchInterface :: DATATABLES_PARAMETER_REGEX ] ) ) ; $ dtSearch -> setValue ( $ rawSearch [ DataTablesSearchInterface :: DATATABLES_PARAMETER_VALUE ] ) ; return $ dtSearch ; }
Parse a raw search .
17,062
public function register ( $ nickname , $ object ) { if ( isset ( $ this -> autoInstantiations [ $ nickname ] ) ) { throw new DuplicateObjectException ( $ nickname ) ; } $ this -> autoInstantiations [ $ nickname ] = $ object ; }
Add an instance of a class to the registry
17,063
public function get ( $ nickname ) { if ( isset ( $ this -> autoInstantiations [ $ nickname ] ) ) { return $ this -> autoInstantiations [ $ nickname ] ; } return null ; }
Get an instance of a class from the registry
17,064
public function getLocation ( ) { $ country = $ this -> getCountry ( ) ; $ city = $ this -> getCity ( ) ; return ( empty ( $ country ) ) ? $ city : $ country . ', ' . $ city ; }
User s location
17,065
public function loadHTML ( $ html ) { $ html = str_replace ( chr ( 13 ) , '' , $ html ) ; $ html = '<?xml version="1.0" encoding="utf-8" ?><' . $ this -> PARENT_TAG_NAME . '>' . $ html . '</' . $ this -> PARENT_TAG_NAME . '>' ; if ( defined ( 'LIBXML_HTML_NODEFDTD' ) ) { return $ this -> dom -> loadHTML ( $ html , LIBXML_HTML_NODEFDTD ) ; } else { return $ this -> dom -> loadHTML ( $ html ) ; } }
Load document markup into the class for cleaning
17,066
public function outputHtml ( ) { $ result = '' ; if ( ! is_null ( $ this -> dom ) ) { $ result = trim ( $ this -> dom -> saveXML ( $ this -> getRealElement ( ) ) ) ; $ result = str_replace ( $ this -> TEMP_CONTENT , '' , $ result ) ; $ parentTagNameLength = strlen ( $ this -> PARENT_TAG_NAME ) ; $ result = substr ( $ result , $ parentTagNameLength + 2 , - ( $ parentTagNameLength + 3 ) ) ; } return $ result ; }
Output the result
17,067
private function cleanNodes ( DOMElement $ elem , $ isFirstNode = false ) { $ nodeName = strtolower ( $ elem -> nodeName ) ; $ textContent = $ elem -> textContent ; if ( $ isFirstNode || array_key_exists ( $ nodeName , $ this -> config -> WhiteListTag ) ) { if ( $ elem -> hasAttributes ( ) ) { $ this -> cleanAttributes ( $ elem ) ; } if ( $ elem -> hasChildNodes ( ) ) { $ children = $ elem -> childNodes ; $ index = $ children -> length ; while ( -- $ index >= 0 ) { $ cleanNode = $ children -> item ( $ index ) ; if ( $ cleanNode instanceof DOMElement ) { $ this -> cleanNodes ( $ cleanNode ) ; } } } else { if ( ! in_array ( $ nodeName , $ this -> emptyElementList ) && ! $ this -> isValidText ( $ textContent ) ) { $ elem -> nodeValue = $ this -> TEMP_CONTENT ; } } } else { if ( $ this -> config -> KeepText === true && $ this -> isValidText ( $ textContent ) ) { $ result = $ elem -> parentNode -> replaceChild ( $ this -> dom -> createTextNode ( $ textContent ) , $ elem ) ; } else { $ result = $ elem -> parentNode -> removeChild ( $ elem ) ; } if ( $ result ) { $ this -> removedTags [ ] = $ nodeName ; } else { throw new Exception ( 'Failed to remove node from DOM' ) ; } } }
Recursivly remove elements from the DOM that aren t whitelisted
17,068
private function cleanAttributes ( DOMElement $ elem ) { $ tagName = strtolower ( $ elem -> nodeName ) ; $ attributes = $ elem -> attributes ; $ attributesWhiteList = $ this -> config -> WhiteListHtmlGlobalAttributes ; $ attributesFilterMap = array ( ) ; $ allowDataAttribute = in_array ( "data-*" , $ attributesWhiteList ) ; $ whiteListAttr = $ this -> config -> getWhiteListAttr ( $ tagName ) ; foreach ( $ whiteListAttr as $ key => $ val ) { if ( is_string ( $ val ) ) { $ attributesWhiteList [ ] = $ val ; } if ( $ val instanceof Closure ) { $ attributesWhiteList [ ] = $ key ; $ attributesFilterMap [ $ key ] = $ val ; } } $ index = $ attributes -> length ; while ( -- $ index >= 0 ) { $ domAttr = $ attributes -> item ( $ index ) ; $ attrName = strtolower ( $ domAttr -> name ) ; $ attrValue = $ domAttr -> value ; if ( ! in_array ( $ attrName , $ attributesWhiteList ) && $ allowDataAttribute && ( stripos ( $ attrName , "data-" ) !== 0 ) ) { $ elem -> removeAttribute ( $ attrName ) ; } else { if ( isset ( $ attributesFilterMap [ $ attrName ] ) ) { $ filteredAttrValue = $ attributesFilterMap [ $ attrName ] ( $ attrValue ) ; if ( $ filteredAttrValue === false ) { $ elem -> removeAttribute ( $ attrName ) ; } else { if ( $ filteredAttrValue !== $ attrValue ) { $ elem -> setAttribute ( $ attrName , $ filteredAttrValue ) ; } } } else { $ this -> cleanAttrValue ( $ domAttr ) ; } } } }
Clean the attributes of the html tags
17,069
private function cleanAttrValue ( DOMAttr $ domAttr ) { $ attrName = strtolower ( $ domAttr -> name ) ; if ( $ attrName === 'style' && ! empty ( $ this -> config -> WhiteListStyle ) ) { $ styles = explode ( ';' , $ domAttr -> value ) ; foreach ( $ styles as $ key => & $ subStyle ) { $ subStyle = array_map ( "trim" , explode ( ':' , strtolower ( $ subStyle ) , 2 ) ) ; if ( empty ( $ subStyle [ 0 ] ) || ! in_array ( $ subStyle [ 0 ] , $ this -> config -> WhiteListStyle ) ) { unset ( $ styles [ $ key ] ) ; } } $ implodeFunc = function ( $ styleSheet ) { return implode ( ':' , $ styleSheet ) ; } ; $ domAttr -> ownerElement -> setAttribute ( $ attrName , implode ( ';' , array_map ( $ implodeFunc , $ styles ) ) . ';' ) ; } if ( $ attrName === 'class' && ! empty ( $ this -> config -> WhiteListCssClass ) ) { $ domAttr -> ownerElement -> setAttribute ( $ attrName , implode ( ' ' , array_intersect ( preg_split ( '/\s+/' , $ domAttr -> value ) , $ this -> config -> WhiteListCssClass ) ) ) ; } if ( $ attrName === 'src' || $ attrName === 'href' ) { if ( strtolower ( parse_url ( $ domAttr -> value , PHP_URL_SCHEME ) ) === 'javascript' ) { $ domAttr -> ownerElement -> removeAttribute ( $ attrName ) ; } else { $ domAttr -> ownerElement -> setAttribute ( $ attrName , filter_var ( $ domAttr -> value , FILTER_SANITIZE_URL ) ) ; } } }
Clean the value of the attribute
17,070
public function clean ( ) { $ this -> removedTags = array ( ) ; $ elem = $ this -> getRealElement ( ) ; if ( is_null ( $ elem ) ) { return array ( ) ; } $ this -> cleanNodes ( $ elem , true ) ; return $ this -> removedTags ; }
Perform the cleaning of the document
17,071
public function getEntities ( $ type = false , $ offset = 0 , $ limit = 1000 , $ details = "on" ) { if ( $ type ) { $ url = $ this -> url . "contextTypes/" . $ type ; } else { $ url = $ this -> url . "contextEntities/" ; } $ ret = $ this -> restRequest ( $ url . "?offset=$offset&limit=$limit&details=$details" , 'GET' ) -> getResponseBody ( ) ; $ Context = ( new Context \ Context ( $ ret ) ) -> get ( ) ; $ Entities = [ ] ; if ( $ Context instanceof \ stdClass && isset ( $ Context -> errorCode ) ) { switch ( ( int ) $ Context -> errorCode -> code ) { case 404 : case 500 : throw new Exception \ GeneralException ( $ Context -> errorCode -> reasonPhrase , ( int ) $ Context -> errorCode -> code , null , $ ret ) ; default : case 200 : break ; } } else { throw new Exception \ GeneralException ( "Malformed Orion Response" , 500 , null , $ ret ) ; } if ( isset ( $ Context -> contextResponses ) && count ( $ Context -> contextResponses ) > 0 ) { foreach ( $ Context -> contextResponses as $ entity ) { $ t = $ entity -> contextElement -> type ; $ id = $ entity -> contextElement -> id ; if ( ! array_key_exists ( $ t , $ Entities ) ) { $ Entities [ $ t ] = [ ] ; } $ Entities [ $ t ] [ $ id ] = $ entity -> contextElement -> attributes ; } } return new Context \ Context ( $ Entities ) ; }
This method returns Context Entities
17,072
public static function strEscape ( $ str , $ escape = 'plain' ) { switch ( $ escape ) { case 'html' : case 'htmlspecialchars' : $ str = htmlspecialchars ( $ str ) ; break ; case 'htmlentities' : $ str = htmlentities ( $ str , ENT_QUOTES , 'UTF-8' ) ; break ; } return $ str ; }
Escapes a string with one of the known method and returns it
17,073
public static function tag ( $ str , $ wrapTag = 0 , $ attributes = [ ] ) { $ selfclose = [ 'link' , 'input' , 'br' , 'img' ] ; if ( ! is_string ( $ str ) ) { return '' ; } if ( ! is_string ( $ wrapTag ) ) { return $ str ; } $ wrapTag = trim ( strtolower ( $ wrapTag ) ) ; $ attrString = '' ; if ( is_array ( $ attributes ) ) { foreach ( $ attributes as $ attrKey => $ attrVal ) { $ attrKey = htmlspecialchars ( trim ( strtolower ( $ attrKey ) ) , ENT_QUOTES ) ; $ attrVal = htmlspecialchars ( trim ( $ attrVal ) , ENT_QUOTES ) ; $ attrString .= " $attrKey=\"$attrVal\"" ; } } $ return = "<$wrapTag$attrString" ; if ( in_array ( $ wrapTag , $ selfclose ) ) { $ return .= '/>' ; } else { $ return .= ">" . htmlspecialchars ( $ str ) . "</$wrapTag>" ; } return $ return ; }
Primitive html builder
17,074
public static function getAcceptableLanguages ( $ rawList = false ) { if ( $ rawList === false ) { $ rawList = isset ( $ _SERVER [ 'HTTP_ACCEPT_LANGUAGE' ] ) ? $ _SERVER [ 'HTTP_ACCEPT_LANGUAGE' ] : '' ; } $ rawList = strtolower ( $ rawList ) ; $ lang_parse = null ; preg_match_all ( '/([a-z]{1,8}(-[a-z]{1,8})*|\*)\s*(;\s*q\s*=\s*(1(\.0{0,3})?|0(\.[0-9]{0,3})?)?)?/' , $ rawList , $ lang_parse ) ; if ( ! count ( $ lang_parse [ 1 ] ) ) { return [ ] ; } $ langcodes = $ lang_parse [ 1 ] ; $ qvalues = $ lang_parse [ 4 ] ; $ indices = range ( 0 , count ( $ lang_parse [ 1 ] ) - 1 ) ; foreach ( $ indices as $ index ) { if ( $ qvalues [ $ index ] === '' ) { $ qvalues [ $ index ] = 1 ; } elseif ( $ qvalues [ $ index ] == 0 ) { unset ( $ langcodes [ $ index ] , $ qvalues [ $ index ] , $ indices [ $ index ] ) ; } else { $ qvalues [ $ index ] = floatval ( $ qvalues [ $ index ] ) ; } } array_multisort ( $ qvalues , SORT_DESC , SORT_NUMERIC , $ indices , $ langcodes ) ; $ langs = array_combine ( $ langcodes , $ qvalues ) ; return $ langs ; }
Return a list of acceptable languages from an Accept - Language header .
17,075
public static function parseExternalLinks ( $ text ) { static $ urlProtocols = false ; static $ counter = 0 ; if ( ! $ urlProtocols ) { if ( function_exists ( 'wfUrlProtocols' ) ) { $ urlProtocols = wfUrlProtocols ( ) ; } else { $ urlProtocols = 'https?:\/\/|ftp:\/\/' ; } } $ extLinkBracketedRegex = '/(?:(<[^>]*)|' . '\[(((?i)' . $ urlProtocols . ')' . self :: EXT_LINK_URL_CLASS . '+)\p{Zs}*([^\]\\x00-\\x08\\x0a-\\x1F]*?)\]|' . '(((?i)' . $ urlProtocols . ')' . self :: EXT_LINK_URL_CLASS . '+))/Su' ; return preg_replace_callback ( $ extLinkBracketedRegex , function ( array $ bits ) use ( & $ counter ) { if ( $ bits [ 1 ] != '' ) { return $ bits [ 1 ] ; } if ( isset ( $ bits [ 4 ] ) && $ bits [ 4 ] != '' ) { return '<a href="' . $ bits [ 2 ] . '">' . $ bits [ 4 ] . '</a>' ; } elseif ( isset ( $ bits [ 5 ] ) ) { return '<a href="' . $ bits [ 5 ] . '">' . $ bits [ 5 ] . '</a>' ; } else { return '<a href="' . $ bits [ 2 ] . '">[' . ++ $ counter . ']</a>' ; } } , $ text ) ; }
Given a text already html - escaped which contains urls in wiki format convert it to html .
17,076
public static function parseWikiLinks ( $ text , $ articlePath ) { self :: $ articlePath = $ articlePath ; return preg_replace_callback ( '/\[\[:?([^]|]+)(?:\|([^]]*))?\]\]/' , function ( array $ bits ) { if ( ! isset ( $ bits [ 2 ] ) || $ bits [ 2 ] == '' ) { $ bits [ 2 ] = strtr ( $ bits [ 1 ] , '_' , ' ' ) ; } $ article = html_entity_decode ( $ bits [ 1 ] , ENT_QUOTES , 'UTF-8' ) ; return '<a href="' . htmlspecialchars ( self :: prettyEncodedWikiUrl ( self :: $ articlePath , $ article ) , ENT_COMPAT , 'UTF-8' ) . '">' . $ bits [ 2 ] . "</a>" ; } , $ text ) ; }
Given a text already html - escaped which contains wiki links convert them to html .
17,077
public static function prettyEncodedWikiUrl ( $ articlePath , $ article ) { $ s = strtr ( $ article , ' ' , '_' ) ; $ s = urlencode ( $ s ) ; $ s = str_ireplace ( [ '%3B' , '%40' , '%24' , '%21' , '%2A' , '%28' , '%29' , '%2C' , '%2F' , '%3A' ] , [ ';' , '@' , '$' , '!' , '*' , '(' , ')' , ',' , '/' , ':' ] , $ s ) ; $ s = str_replace ( '$1' , $ s , $ articlePath ) ; return $ s ; }
Encode a page title the way MediaWiki would .
17,078
public function upload ( ApiClientContract $ api , $ path , $ body , array $ params = [ ] , $ verifyChecksum = true ) { $ response = $ api -> request ( 'PUT' , $ path , [ 'headers' => $ this -> convertUploadParamsToHeaders ( $ body , $ params , $ verifyChecksum ) , 'body' => $ body , 'query' => $ this -> extractQueryParameters ( $ params ) , ] ) ; if ( $ response -> getStatusCode ( ) !== 201 ) { throw new UploadFailedException ( 'Unable to upload file.' , $ response -> getStatusCode ( ) ) ; } return $ response -> getHeaderLine ( 'ETag' ) ; }
Upload file from string or stream resource .
17,079
protected function convertUploadParamsToHeaders ( $ body = null , array $ params = [ ] , $ verifyChecksum = true ) { $ headers = [ ] ; if ( $ verifyChecksum ) { $ headers [ 'ETag' ] = md5 ( $ body ) ; } $ availableParams = [ 'contentType' => 'Content-Type' , 'contentDisposition' => 'Content-Disposition' , 'deleteAfter' => 'X-Delete-After' , 'deleteAt' => 'X-Delete-At' , ] ; foreach ( $ availableParams as $ key => $ header ) { if ( isset ( $ params [ $ key ] ) ) { $ headers [ $ header ] = $ params [ $ key ] ; } } return $ headers ; }
Parses upload parameters and assigns them to appropriate HTTP headers .
17,080
protected function extractQueryParameters ( array $ params ) { $ availableParams = [ 'extract-archive' ] ; $ query = [ ] ; foreach ( $ params as $ key => $ value ) { if ( in_array ( $ key , $ availableParams ) ) { $ query [ $ key ] = $ value ; } } return $ query ; }
Parses upload parameters and assigns them to appropriate query parameters .
17,081
public function getToken ( ) { $ token = $ this -> cache -> get ( $ this -> tokenName ) ; if ( $ token === false ) { $ token = Algorithms :: generateRandomToken ( 20 ) ; $ this -> storeToken ( $ token ) ; } return $ token ; }
Fetch the token or generate a new random token
17,082
public function setDir ( $ dir ) { if ( false === in_array ( $ dir , DataTablesEnumerator :: enumDirs ( ) ) ) { $ dir = self :: DATATABLES_DIR_ASC ; } $ this -> dir = strtoupper ( $ dir ) ; return $ this ; }
Set the dir .
17,083
public function getHttpClient ( ) { if ( ! is_null ( $ this -> httpClient ) ) { return $ this -> httpClient ; } return $ this -> httpClient = new Client ( [ 'base_uri' => $ this -> storageUrl ( ) , 'headers' => [ 'X-Auth-Token' => $ this -> token ( ) , ] , ] ) ; }
HTTP Client .
17,084
public function authenticate ( ) { if ( ! is_null ( $ this -> token ) ) { return ; } $ response = $ this -> authenticationResponse ( ) ; if ( ! $ response -> hasHeader ( 'X-Auth-Token' ) ) { throw new AuthenticationFailedException ( 'Given credentials are wrong.' , 403 ) ; } if ( ! $ response -> hasHeader ( 'X-Storage-Url' ) ) { throw new RuntimeException ( 'Storage URL is missing.' , 500 ) ; } $ this -> token = $ response -> getHeaderLine ( 'X-Auth-Token' ) ; $ this -> storageUrl = $ response -> getHeaderLine ( 'X-Storage-Url' ) ; }
Performs authentication request .
17,085
public function authenticationResponse ( ) { $ client = new Client ( ) ; try { $ response = $ client -> request ( 'GET' , static :: AUTH_URL , [ 'headers' => [ 'X-Auth-User' => $ this -> username , 'X-Auth-Key' => $ this -> password , ] , ] ) ; } catch ( RequestException $ e ) { throw new AuthenticationFailedException ( 'Given credentials are wrong.' , 403 ) ; } return $ response ; }
Performs authentication request and returns its response .
17,086
function iconv ( $ in , $ out , $ string ) { if ( strcasecmp ( $ in , 'x' ) == 0 && strcasecmp ( $ out , 'utf-8' ) == 0 ) { return preg_replace_callback ( '/([cghjsu]x?)((?:xx)*)(?!x)/i' , array ( $ this , 'strrtxuCallback' ) , $ string ) ; } elseif ( strcasecmp ( $ in , 'UTF-8' ) == 0 && strcasecmp ( $ out , 'x' ) == 0 ) { return preg_replace_callback ( '/((?:[cghjsu]|\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]|\xc5[\x9c\x9d\xac\xad])x*)/i' , array ( $ this , 'strrtuxCallback' ) , $ string ) ; } return parent :: iconv ( $ in , $ out , $ string ) ; }
Wrapper for charset conversions .
17,087
public static function getTransactionTypeByName ( $ transType ) { switch ( $ transType ) { case 'creditCardTransaction' : return new GiroCheckout_SDK_CreditCardTransaction ( ) ; case 'creditCardCapture' : return new GiroCheckout_SDK_CreditCardCapture ( ) ; case 'creditCardRefund' : return new GiroCheckout_SDK_CreditCardRefund ( ) ; case 'creditCardGetPKN' : return new GiroCheckout_SDK_CreditCardGetPKN ( ) ; case 'creditCardRecurringTransaction' : return new GiroCheckout_SDK_CreditCardRecurringTransaction ( ) ; case 'creditCardVoid' : return new GiroCheckout_SDK_CreditCardVoid ( ) ; case 'directDebitTransaction' : return new GiroCheckout_SDK_DirectDebitTransaction ( ) ; case 'directDebitGetPKN' : return new GiroCheckout_SDK_DirectDebitGetPKN ( ) ; case 'directDebitTransactionWithPaymentPage' : return new GiroCheckout_SDK_DirectDebitTransactionWithPaymentPage ( ) ; case 'directDebitCapture' : return new GiroCheckout_SDK_DirectDebitCapture ( ) ; case 'directDebitRefund' : return new GiroCheckout_SDK_DirectDebitRefund ( ) ; case 'directDebitVoid' : return new GiroCheckout_SDK_DirectDebitVoid ( ) ; case 'giropayBankstatus' : return new GiroCheckout_SDK_GiropayBankstatus ( ) ; case 'giropayIDCheck' : return new GiroCheckout_SDK_GiropayIDCheck ( ) ; case 'giropayTransaction' : return new GiroCheckout_SDK_GiropayTransaction ( ) ; case 'giropayIssuerList' : return new GiroCheckout_SDK_GiropayIssuerList ( ) ; case 'idealIssuerList' : return new GiroCheckout_SDK_IdealIssuerList ( ) ; case 'idealPayment' : return new GiroCheckout_SDK_IdealPayment ( ) ; case 'idealRefund' : return new GiroCheckout_SDK_IdealPaymentRefund ( ) ; case 'paypalTransaction' : return new GiroCheckout_SDK_PaypalTransaction ( ) ; case 'epsBankstatus' : return new GiroCheckout_SDK_EpsBankstatus ( ) ; case 'epsTransaction' : return new GiroCheckout_SDK_EpsTransaction ( ) ; case 'epsIssuerList' : return new GiroCheckout_SDK_EpsIssuerList ( ) ; case 'getTransactionTool' : return new GiroCheckout_SDK_Tools_GetTransaction ( ) ; case 'giroCodeCreatePayment' : return new GiroCheckout_SDK_GiroCodeCreatePayment ( ) ; case 'giroCodeCreateEpc' : return new GiroCheckout_SDK_GiroCodeCreateEpc ( ) ; case 'giroCodeGetEpc' : return new GiroCheckout_SDK_GiroCodeGetEpc ( ) ; case 'paydirektTransaction' : return new GiroCheckout_SDK_PaydirektTransaction ( ) ; case 'paydirektCapture' : return new GiroCheckout_SDK_PaydirektCapture ( ) ; case 'paydirektRefund' : return new GiroCheckout_SDK_PaydirektRefund ( ) ; case 'paydirektVoid' : return new GiroCheckout_SDK_PaydirektVoid ( ) ; case 'sofortuwTransaction' : return new GiroCheckout_SDK_SofortUwTransaction ( ) ; case 'blueCodeTransaction' : return new GiroCheckout_SDK_BlueCodeTransaction ( ) ; case 'paypageTransaction' : return new GiroCheckout_SDK_PaypageTransaction ( ) ; case 'paypageProjects' : return new GiroCheckout_SDK_PaypageProjects ( ) ; case 'maestroTransaction' : return new GiroCheckout_SDK_MaestroTransaction ( ) ; case 'maestroCapture' : return new GiroCheckout_SDK_MaestroCapture ( ) ; case 'maestroRefund' : return new GiroCheckout_SDK_MaestroRefund ( ) ; } return null ; }
Returns api call instance
17,088
public function getRoutable ( $ controller , $ prefix ) { $ routable = [ ] ; $ reflection = new ReflectionClass ( $ controller ) ; $ methods = $ reflection -> getMethods ( ReflectionMethod :: IS_PUBLIC ) ; foreach ( $ methods as $ method ) { if ( $ this -> isRoutable ( $ method ) ) { $ data = $ this -> getMethodData ( $ method , $ prefix ) ; $ routable [ $ method -> name ] [ ] = $ data ; if ( $ data [ 'plain' ] == $ prefix . '/index' ) { $ routable [ $ method -> name ] [ ] = $ this -> getIndexData ( $ data , $ prefix ) ; } } } return $ routable ; }
Get the routable methods for a controller .
17,089
public function getMethodData ( ReflectionMethod $ method , $ prefix ) { $ verb = $ this -> getVerb ( $ name = $ method -> name ) ; $ uri = $ this -> addUriWildcards ( $ plain = $ this -> getPlainUri ( $ name , $ prefix ) ) ; return compact ( 'verb' , 'plain' , 'uri' ) ; }
Get the method data for a given method .
17,090
public function getLanguage ( ) { $ configuration = $ this -> getConfiguration ( ) ; $ result = ! empty ( $ configuration [ 'lang' ] ) ? $ configuration [ 'lang' ] : $ this -> getDefaultLanguage ( ) ; return ( $ result !== '' ) ? $ result : 'default' ; }
Gets this user s language . Will be a two - letter lg_typo3 key of the static_languages table or default for the default language .
17,091
public function getAllGroups ( ) { $ result = new \ Tx_Oelib_List ( ) ; $ groupsToProcess = $ this -> getGroups ( ) ; do { $ groupsForNextStep = new \ Tx_Oelib_List ( ) ; $ result -> append ( $ groupsToProcess ) ; foreach ( $ groupsToProcess as $ group ) { $ subgroups = $ group -> getSubgroups ( ) ; foreach ( $ subgroups as $ subgroup ) { if ( ! $ result -> hasUid ( $ subgroup -> getUid ( ) ) ) { $ groupsForNextStep -> add ( $ subgroup ) ; } } } $ groupsToProcess = $ groupsForNextStep ; } while ( ! $ groupsToProcess -> isEmpty ( ) ) ; return $ result ; }
Recursively gets all groups and subgroups of this user .
17,092
private function getConfiguration ( ) { if ( empty ( $ this -> configuration ) ) { $ this -> configuration = unserialize ( $ this -> getAsString ( 'uc' ) ) ; } return $ this -> configuration ; }
Retrieves the user s configuration and unserializes it .
17,093
public function getErrorData ( $ key = null ) { if ( $ this -> isSuccessful ( ) ) { return null ; } $ data = isset ( $ this -> getData ( 'data' ) [ 0 ] ) ? $ this -> getData ( 'data' ) [ 0 ] : null ; if ( $ key ) { return isset ( $ data [ $ key ] ) ? $ data [ $ key ] : null ; } return $ data ; }
Get error data from response
17,094
public function getMessage ( ) { if ( $ this -> getErrorMessage ( ) ) { return $ this -> getErrorMessage ( ) . ' (' . $ this -> getErrorFieldName ( ) . ')' ; } if ( $ this -> isSuccessful ( ) ) { return ( $ this -> getStatus ( ) ) ? ucfirst ( $ this -> getStatus ( ) ) : 'Successful' ; } return 'The transaction was unsuccessful.' ; }
Get error message from the response
17,095
public function getHttpResponseCodeText ( ) { $ code = $ this -> getHttpResponseCode ( ) ; $ statusTexts = \ Symfony \ Component \ HttpFoundation \ Response :: $ statusTexts ; return ( isset ( $ statusTexts [ $ code ] ) ) ? $ statusTexts [ $ code ] : null ; }
Get HTTP Response code text
17,096
protected function buildDataTablesResponse ( Request $ request , $ name , ActionResponse $ output ) { if ( true === $ request -> isXmlHttpRequest ( ) ) { return new JsonResponse ( $ output ) ; } switch ( $ output -> getStatus ( ) ) { case 200 : $ this -> notifySuccess ( $ output -> getNotify ( ) ) ; break ; case 404 : $ this -> notifyDanger ( $ output -> getNotify ( ) ) ; break ; case 500 : $ this -> notifyWarning ( $ output -> getNotify ( ) ) ; break ; } return $ this -> redirectToRoute ( "jquery_datatables_index" , [ "name" => $ name ] ) ; }
Build a response .
17,097
protected function exportDataTablesCallback ( DataTablesProviderInterface $ dtProvider , DataTablesRepositoryInterface $ repository , DataTablesCSVExporterInterface $ dtExporter , $ windows ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ stream = fopen ( "php://output" , "w+" ) ; fputcsv ( $ stream , DataTablesExportHelper :: convert ( $ dtExporter -> exportColumns ( ) , $ windows ) , ";" ) ; $ total = $ repository -> dataTablesCountExported ( $ dtProvider ) ; $ pages = PaginateHelper :: getPagesCount ( $ total , DataTablesRepositoryInterface :: REPOSITORY_LIMIT ) ; for ( $ i = 0 ; $ i < $ pages ; ++ $ i ) { list ( $ offset , $ limit ) = PaginateHelper :: getPageOffsetAndLimit ( $ i , DataTablesRepositoryInterface :: REPOSITORY_LIMIT , $ total ) ; $ result = $ repository -> dataTablesExportAll ( $ dtProvider ) -> setFirstResult ( $ offset ) -> setMaxResults ( $ limit ) -> getQuery ( ) -> iterate ( ) ; while ( false !== ( $ row = $ result -> next ( ) ) ) { $ this -> dispatchDataTablesEvent ( DataTablesEvents :: DATATABLES_PRE_EXPORT , [ $ row [ 0 ] ] ) ; fputcsv ( $ stream , DataTablesExportHelper :: convert ( $ dtExporter -> exportRow ( $ row [ 0 ] ) , $ windows ) , ";" ) ; $ em -> detach ( $ row [ 0 ] ) ; $ this -> dispatchDataTablesEvent ( DataTablesEvents :: DATATABLES_POST_EXPORT , [ $ row [ 0 ] ] ) ; } } fclose ( $ stream ) ; }
Export callback .
17,098
protected function getDataTablesColumn ( DataTablesProviderInterface $ dtProvider , $ data ) { $ this -> getLogger ( ) -> debug ( sprintf ( "DataTables controller search for a column with name \"%s\"" , $ data ) ) ; $ dtColumn = $ this -> getDataTablesWrapper ( $ dtProvider ) -> getColumn ( $ data ) ; if ( null === $ dtColumn ) { throw new BadDataTablesColumnException ( $ data ) ; } $ this -> getLogger ( ) -> debug ( sprintf ( "DataTables controller found a column with name \"%s\"" , $ data ) ) ; return $ dtColumn ; }
Get a column .
17,099
protected function getDataTablesEntityById ( DataTablesProviderInterface $ dtProvider , $ id ) { $ repository = $ this -> getDataTablesRepository ( $ dtProvider ) ; $ this -> getLogger ( ) -> debug ( sprintf ( "DataTables controller search for an entity [%s]" , $ id ) ) ; $ entity = $ repository -> find ( $ id ) ; if ( null === $ entity ) { throw EntityNotFoundException :: fromClassNameAndIdentifier ( $ dtProvider -> getEntity ( ) , [ $ id ] ) ; } $ this -> getLogger ( ) -> debug ( sprintf ( "DataTables controller found an entity [%s]" , $ id ) ) ; return $ entity ; }
Get an entity by id .