idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
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' ) !== fa...
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 ( ) ->...
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 ( ) ) ; ...
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 ) , subst...
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%" ...
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" ] [...
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 -> ab...
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 -...
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 ( ) )...
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 ( ) , 'eta...
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...
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 -> secr...
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 [ '...
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 = $ thi...
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 -> i...
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 && $ flexformsVal...
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 ...
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 = (...
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...
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 ( ! arr...
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 ; } r...
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...
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 ; }...
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 ( ...
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 -> setProvide...
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 ) {...
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 ( $ rawOrd...
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 ] ) ) ; ...
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 , LIBX...
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 ( $ r...
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...
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-*" , $ attributesWhiteLis...
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" , ex...
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' )...
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 ( $ attribute...
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*(;...
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 = '/(?:(<[^>]*)|' . '...
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 ] , '_' , ' ' ) ; } $ art...
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 ) ; $...
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 -> extractQueryPa...
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'...
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-...
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 ...
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' ) == ...
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_CreditCar...
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 ( ...
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 ( $ subgrou...
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 unsu...
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 : ...
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 , DataTab...
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 === $ d...
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 (...
Get an entity by id .