idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
20,200 | public function encode ( $ password , $ salt = null ) { return ( isset ( $ this -> hasher ) ? $ this -> hasher -> getHashedPassword ( $ password , $ salt ) : $ password ) ; } | Returns the hashed password . |
20,201 | public static function fromFQDN ( $ fqdn , $ subCommand = null ) { if ( function_exists ( $ fqdn ) ) { return self :: fromFunction ( $ fqdn ) ; } if ( class_exists ( $ fqdn ) && is_subclass_of ( $ fqdn , 'ConsoleKit\Command' ) ) { return self :: fromCommandClass ( $ fqdn , $ subCommand ) ; } throw new ConsoleException ( "'$fqdn' is not a valid ConsoleKit FQDN" ) ; } | Creates an Help object from a FQDN |
20,202 | public static function fromCommandClass ( $ name , $ subCommand = null ) { $ prefix = 'execute' ; $ class = new ReflectionClass ( $ name ) ; if ( $ subCommand ) { $ method = $ prefix . ucfirst ( Utils :: camelize ( $ subCommand ) ) ; if ( ! $ class -> hasMethod ( $ method ) ) { throw new ConsoleException ( "Sub command '$subCommand' of '$name' does not exist" ) ; } return new Help ( $ class -> getMethod ( $ method ) -> getDocComment ( ) ) ; } $ help = new Help ( $ class -> getDocComment ( ) ) ; foreach ( $ class -> getMethods ( ) as $ method ) { if ( strlen ( $ method -> getName ( ) ) > strlen ( $ prefix ) && substr ( $ method -> getName ( ) , 0 , strlen ( $ prefix ) ) === $ prefix ) { $ help -> subCommands [ ] = Utils :: dashized ( substr ( $ method -> getName ( ) , strlen ( $ prefix ) ) ) ; } } return $ help ; } | Creates an Help object from a class subclassing Command |
20,203 | protected function linksToArray ( ) : array { $ links = [ ] ; foreach ( $ this -> links as $ name => $ link ) { if ( ! $ link -> hasMetadata ( ) ) { $ links [ $ name ] = $ link -> getReference ( ) ; continue ; } $ links [ $ name ] = [ 'href' => $ link -> getReference ( ) , 'meta' => $ link -> getMetadata ( ) ] ; } return $ links ; } | Cast links to an array |
20,204 | public function setProcessorType ( $ processorType ) { if ( ! in_array ( $ processorType , static :: $ allowedProcessorTypes ) ) { throw new RuntimeException ( "Unknown transaction processor type given: {$processorType}" ) ; } if ( ! empty ( $ this -> processorType ) ) { throw new RuntimeException ( 'You can set payment transaction processor type only once' ) ; } $ this -> processorType = $ processorType ; return $ this ; } | Set payment transaction processor type |
20,205 | public function setProcessorName ( $ processorName ) { if ( ! empty ( $ this -> processorName ) ) { throw new RuntimeException ( 'You can set payment transaction processor name only once' ) ; } $ this -> processorName = $ processorName ; return $ this ; } | Set payment transaction processor name |
20,206 | public function setStatus ( $ status ) { if ( ! in_array ( $ status , static :: $ allowedStatuses ) ) { throw new RuntimeException ( "Unknown transaction status given: {$status}" ) ; } $ this -> status = $ status ; return $ this ; } | Set payment transaction status |
20,207 | public function setPayment ( Payment $ payment ) { $ this -> payment = $ payment ; if ( ! $ payment -> hasPaymentTransaction ( $ this ) ) { $ payment -> addPaymentTransaction ( $ this ) ; } return $ this ; } | Set payment transaction payment |
20,208 | public function get ( $ args ) { $ dataItem = $ this -> create ( $ args ) ; if ( $ dataItem -> hasId ( ) ) { $ dataItem = $ this -> getById ( $ dataItem -> getId ( ) ) ; } return $ dataItem ; } | Get by ID array or object |
20,209 | public function fetchList ( $ statement ) { $ result = array ( ) ; foreach ( $ this -> getConnection ( ) -> fetchAll ( $ statement ) as $ row ) { $ result [ ] = current ( $ row ) ; } return $ result ; } | Executes statement and fetch list as array |
20,210 | public function getPlatformName ( ) { static $ name = null ; if ( ! $ name ) { $ name = $ this -> connection -> getDatabasePlatform ( ) -> getName ( ) ; } return $ name ; } | Get platform name |
20,211 | public function prepareResults ( & $ rows ) { foreach ( $ rows as $ key => & $ row ) { $ row = $ this -> create ( $ row ) ; } return $ rows ; } | Convert results to DataItem objects |
20,212 | public function getById ( $ id ) { $ list = $ this -> getByCriteria ( $ id , $ this -> getUniqueId ( ) ) ; return reset ( $ list ) ; } | Get data item by id |
20,213 | public function getByCriteria ( $ criteria , $ fieldName ) { $ queryBuilder = $ this -> getSelectQueryBuilder ( ) ; $ queryBuilder -> where ( $ fieldName . " = :criteria" ) ; $ queryBuilder -> setParameter ( 'criteria' , $ criteria ) ; $ statement = $ queryBuilder -> execute ( ) ; $ rows = $ statement -> fetchAll ( ) ; $ this -> prepareResults ( $ rows ) ; return $ rows ; } | List objects by criteria |
20,214 | protected function extractTypeValues ( array $ data , array $ types ) { $ typeValues = array ( ) ; foreach ( $ data as $ k => $ _ ) { $ typeValues [ ] = isset ( $ types [ $ k ] ) ? $ types [ $ k ] : \ PDO :: PARAM_STR ; } return $ typeValues ; } | Extract ordered type list from two associate key lists of data and types . |
20,215 | public function setCustomerID ( $ id ) { if ( preg_match ( '/[^A-Za-z0-9]/' , $ id ) ) { throw new ErrorException ( 'Customer ID has invalid characters' ) ; } elseif ( strlen ( $ id ) > 8 ) { throw new ErrorException ( 'Customer ID cannot be longer than eight (8) characters' ) ; } $ this -> customerID = $ id ; return $ this ; } | Sets the unique eWay customer ID . |
20,216 | public function setCardHoldersName ( $ name ) { if ( preg_match ( '/[^A-Za-z\s\'-\.]/' , $ name ) ) { throw new ErrorException ( 'Card holder name has invalid chracters.' ) ; } elseif ( strlen ( $ name ) > 50 ) { throw new ErrorException ( 'Card holder name longer than fifty (50) characters' ) ; } $ this -> cardHoldersName = $ name ; return $ this ; } | Sets the card holder s name . |
20,217 | public function setCardNumber ( $ number ) { $ number = preg_replace ( '/[^\d]/' , '' , $ number ) ; if ( strlen ( $ number ) > 20 ) { throw new ErrorException ( 'Card number longer than twenty (20) digits' ) ; } $ this -> cardNumber = $ number ; return $ this ; } | Sets the card number . |
20,218 | protected function sizeMax ( $ key , $ lengthValue , $ max , $ not = true ) { if ( ( $ lengthValue > $ max ) && $ not ) { $ this -> addReturn ( $ key , 'must' , [ ':max' => $ max ] ) ; } elseif ( ! ( $ lengthValue > $ max ) && ! $ not ) { $ this -> addReturn ( $ key , 'not' , [ ':max' => $ max ] ) ; } } | Test si une valeur est plus grande que la valeur de comparaison . |
20,219 | public function registerRepository ( string $ name , RepositoryInterface $ repository ) { if ( isset ( $ this -> repositories [ $ name ] ) ) { throw new \ LogicException ( sprintf ( 'Links\' Repository "%s" is already registered.' , $ name ) ) ; } $ this -> repositories [ $ name ] = $ repository ; } | Register links repository |
20,220 | public function getRepository ( string $ name ) : RepositoryInterface { if ( isset ( $ this -> repositories [ $ name ] ) ) { return $ this -> repositories [ $ name ] ; } throw new \ LogicException ( sprintf ( 'Unknown repository "%s"' , $ name ) ) ; } | Get links repository by name |
20,221 | private function checkMemoryLimit ( ) { if ( function_exists ( 'ini_get' ) ) { $ memoryInBytes = function ( $ value ) { $ unit = strtolower ( substr ( $ value , - 1 , 1 ) ) ; $ value = ( int ) $ value ; switch ( $ unit ) { case 'g' : $ value *= 1024 * 1024 * 1024 ; break ; case 'm' : $ value *= 1024 * 1024 ; break ; case 'k' : $ value *= 1024 ; break ; } return $ value ; } ; $ memoryLimit = trim ( ini_get ( 'memory_limit' ) ) ; if ( $ memoryLimit != - 1 && $ memoryInBytes ( $ memoryLimit ) < 512 * 1024 * 1024 ) { trigger_error ( "Configured memory limit ($memoryLimit) is lower " . "than 512M; composer-wrapper may not work " . "correctly. Consider increasing PHP's " . "memory_limit to at least 512M." , E_USER_NOTICE ) ; } } } | Check whether the current setup meets the minimum memory requirements for composer ; raise a notice if not . |
20,222 | public function run ( $ input = '' , $ output = null ) { $ this -> loadComposerPhar ( false ) ; if ( ! $ this -> application ) { $ this -> application = new \ Composer \ Console \ Application ( ) ; $ this -> application -> setAutoExit ( false ) ; } $ cli_args = is_string ( $ input ) && ! empty ( $ input ) ? new \ Symfony \ Component \ Console \ Input \ StringInput ( $ input ) : null ; $ argv0 = $ _SERVER [ 'argv' ] [ 0 ] ; $ this -> fixSelfupdate ( $ cli_args ) ; $ exitcode = $ this -> application -> run ( $ cli_args , $ output ) ; $ _SERVER [ 'argv' ] [ 0 ] = $ argv0 ; return $ exitcode ; } | Run this composer wrapper as a command - line application . |
20,223 | public function getAttachmentsTags ( $ list = true ) { $ tags = $ this -> config ( 'tags' ) ; if ( ! $ list ) { return $ tags ; } $ tagsList = [ ] ; foreach ( $ tags as $ key => $ tag ) { $ tagsList [ $ key ] = $ tag [ 'caption' ] ; } return $ tagsList ; } | get the configured tags |
20,224 | public function saveTags ( $ attachment , $ tags ) { $ newTags = [ ] ; foreach ( $ tags as $ tag ) { if ( isset ( $ this -> config ( 'tags' ) [ $ tag ] ) ) { $ newTags [ ] = $ tag ; if ( $ this -> config ( 'tags' ) [ $ tag ] [ 'exclusive' ] === true ) { $ this -> _clearTag ( $ attachment , $ tag ) ; } } } $ this -> Attachments -> patchEntity ( $ attachment , [ 'tags' => $ newTags ] ) ; return ( bool ) $ this -> Attachments -> save ( $ attachment ) ; } | method to save the tags of an attachment |
20,225 | public function month ( int $ vehicleId , int $ year , int $ month = 1 , ? Query $ query = null ) : Response { $ this -> requiresAccessToken ( ) ; return $ this -> send ( 'GET' , "vehicles/{$vehicleId}/checkpoints/{$year}/{$month}" , $ this -> getApiHeaders ( ) , $ this -> buildHttpQuery ( $ query ) ) ; } | Get checkpoints for the month . |
20,226 | public function yesterday ( int $ vehicleId ) : Response { $ this -> requiresAccessToken ( ) ; return $ this -> send ( 'GET' , "vehicles/{$vehicleId}/travels/summaries/yesterday" , $ this -> getApiHeaders ( ) ) ; } | Get travel for yesterday . |
20,227 | public function date ( int $ vehicleId , int $ year , int $ month = 1 , int $ day = 1 ) : Response { $ this -> requiresAccessToken ( ) ; return $ this -> send ( 'GET' , "vehicles/{$vehicleId}/travels/summaries/{$year}/{$month}/{$day}" , $ this -> getApiHeaders ( ) ) ; } | Get travel for the date . |
20,228 | protected function registerNotification ( array $ notification ) { $ view = $ this -> getView ( ) ; $ options = Json :: encode ( ArrayHelper :: merge ( $ this -> getClientOptions ( ) , $ notification ) ) ; $ view -> registerJs ( "new PNotify({$options});" ) ; } | Registers JS for PNotify plugin . |
20,229 | public function addDependencies ( ) { $ this -> Html -> script ( '/attachments/js/vendor/jquery.ui.widget.js' , [ 'block' => true ] ) ; $ this -> Html -> script ( '/attachments/js/vendor/jquery.iframe-transport.js' , [ 'block' => true ] ) ; $ this -> Html -> script ( '/attachments/js/vendor/jquery.fileupload.js' , [ 'block' => true ] ) ; $ this -> Html -> script ( '/attachments/js/app/lib/AttachmentsWidget.js' , [ 'block' => true ] ) ; $ this -> Html -> css ( '/attachments/css/attachments.css' , [ 'block' => true ] ) ; } | Inject JS dependencies to the HTML helper |
20,230 | public function attachmentsArea ( EntityInterface $ entity , array $ options = [ ] ) { if ( $ this -> config ( 'includeDependencies' ) ) { $ this -> addDependencies ( ) ; } $ options = Hash :: merge ( [ 'label' => false , 'id' => 'fileupload-' . uniqid ( ) , 'formFieldName' => false , 'mode' => 'full' , 'style' => '' , 'taggable' => false , 'isAjax' => false , 'panelHeading' => __d ( 'attachments' , 'attachments' ) , 'showIconColumn' => true , 'additionalButtons' => null ] , $ options ) ; return $ this -> _View -> element ( 'Attachments.attachments_area' , compact ( 'options' , 'entity' ) ) ; } | Render an attachments area for the given entity |
20,231 | public function tagsList ( $ attachment ) { $ tagsString = '' ; if ( empty ( $ attachment -> tags ) ) { return $ tagsString ; } $ Table = TableRegistry :: get ( $ attachment -> model ) ; foreach ( $ attachment -> tags as $ tag ) { $ tagsString .= '<label class="label label-default">' . $ Table -> getTagCaption ( $ tag ) . '</label> ' ; } return $ tagsString ; } | Render a list of tags of given attachment |
20,232 | public function tagsChooser ( EntityInterface $ entity , $ attachment ) { if ( ! TableRegistry :: exists ( $ entity -> source ( ) ) ) { throw new Cake \ Network \ Exception \ MissingTableException ( 'Could not find Table ' . $ entity -> source ( ) ) ; } $ Table = TableRegistry :: get ( $ entity -> source ( ) ) ; return $ this -> Form -> select ( 'tags' , $ Table -> getAttachmentsTags ( ) , [ 'type' => 'select' , 'class' => 'tag-chooser' , 'style' => 'display: block; width: 100%' , 'label' => false , 'multiple' => true , 'value' => $ attachment -> tags ] ) ; } | Render a multi select with all available tags of entity and the tags of attachment preselected |
20,233 | public function toResource ( $ object ) : ResourceObject { $ context = $ this -> createContext ( get_class ( $ object ) ) ; $ id = $ this -> identifierHandler -> getIdentifier ( $ object , $ context ) ; $ type = $ this -> resolveType ( $ object , $ context ) ; $ resource = new ResourceObject ( $ id , $ type ) ; foreach ( $ this -> handlers as $ handler ) { $ handler -> toResource ( $ object , $ resource , $ context ) ; } return $ resource ; } | Map object s data to resource |
20,234 | public function toResourceIdentifier ( $ object ) : ResourceIdentifierObject { $ context = $ this -> createContext ( get_class ( $ object ) ) ; $ id = $ this -> identifierHandler -> getIdentifier ( $ object , $ context ) ; $ type = $ this -> resolveType ( $ object , $ context ) ; return new ResourceIdentifierObject ( $ id , $ type ) ; } | Map object s identification to resource - identifier |
20,235 | public function fromResource ( $ object , ResourceObject $ resource ) { $ context = $ this -> createContext ( get_class ( $ object ) ) ; $ this -> identifierHandler -> setIdentifier ( $ object , $ resource -> getId ( ) , $ context ) ; foreach ( $ this -> handlers as $ handler ) { $ handler -> fromResource ( $ object , $ resource , $ context ) ; } } | Map resource s data to provided object |
20,236 | protected function resolveType ( $ object , MappingContext $ context ) : string { $ definition = $ context -> getDefinition ( ) ; if ( $ definition -> hasType ( ) ) { return $ definition -> getType ( ) ; } return $ this -> typeHandler -> getType ( $ object , $ context ) ; } | Resolve type of resource |
20,237 | protected function createContext ( string $ class ) : MappingContext { $ definition = $ this -> definitionProvider -> getDefinition ( $ class ) ; return new MappingContext ( $ this , $ definition ) ; } | Create mapping context for given class |
20,238 | protected function resolveTypeDescription ( $ value ) : string { $ type = gettype ( $ value ) ; if ( $ type === 'object' ) { return 'an instance of ' . get_class ( $ value ) ; } if ( $ type === 'integer' ) { return 'an integer' ; } return 'a ' . $ type ; } | Resolve description of value s type |
20,239 | public function setHasherTypo3 ( \ TYPO3 \ CMS \ Saltedpasswords \ Salt \ SaltInterface $ object ) { $ this -> hasher = $ object ; return $ this ; } | Sets the TYPO3 password hasher object |
20,240 | public static function transformColumnNames ( & $ rows ) { $ columnNames = array_keys ( current ( $ rows ) ) ; foreach ( $ rows as & $ row ) { foreach ( $ columnNames as $ name ) { $ row [ strtolower ( $ name ) ] = & $ row [ $ name ] ; unset ( $ row [ $ name ] ) ; } } } | Transform result column names from lower case to upper |
20,241 | public static function units ( ) { if ( isset ( self :: $ unitConverter ) ) { return self :: $ unitConverter ; } self :: $ unitConverter = new UnitConverter ( ) ; return self :: $ unitConverter ; } | Get a singleton Unit Converter Class |
20,242 | protected function filterProtocolVersion ( $ version ) { if ( ! is_string ( $ version ) || ! in_array ( $ version , $ this -> protocols ) ) { throw new \ InvalidArgumentException ( 'The specified protocol is invalid.' ) ; } return $ version ; } | Filtre la version du protocole . |
20,243 | public static function getAuthorizationHeader ( ) { $ headers = null ; if ( isset ( $ _SERVER [ 'Authorization' ] ) ) { $ headers = trim ( $ _SERVER [ "Authorization" ] ) ; } else if ( isset ( $ _SERVER [ 'HTTP_AUTHORIZATION' ] ) ) { $ headers = trim ( $ _SERVER [ "HTTP_AUTHORIZATION" ] ) ; } elseif ( function_exists ( 'apache_request_headers' ) ) { $ requestHeaders = apache_request_headers ( ) ; $ requestHeaders = array_combine ( array_map ( 'ucwords' , array_keys ( $ requestHeaders ) ) , array_values ( $ requestHeaders ) ) ; if ( isset ( $ requestHeaders [ 'Authorization' ] ) ) { $ headers = trim ( $ requestHeaders [ 'Authorization' ] ) ; } } return $ headers ; } | Get hearder Authorization |
20,244 | protected function getSimple ( $ fieldName , $ objectName = "object" , $ default = null ) { if ( isset ( $ this -> { $ objectName } -> { $ fieldName } ) ) { $ this -> out [ $ fieldName ] = trim ( $ this -> { $ objectName } -> { $ fieldName } ) ; } else { $ this -> out [ $ fieldName ] = $ default ; } return $ this ; } | Common Reading of a Single Field |
20,245 | protected function getSimpleBool ( $ fieldName , $ objectName = "object" , $ default = false ) { if ( isset ( $ this -> { $ objectName } -> { $ fieldName } ) ) { $ this -> out [ $ fieldName ] = ( bool ) trim ( $ this -> { $ objectName } -> { $ fieldName } ) ; } else { $ this -> out [ $ fieldName ] = ( bool ) $ default ; } return $ this ; } | Common Reading of a Single Bool Field |
20,246 | protected function getSimpleDouble ( $ fieldName , $ objectName = "object" , $ default = 0 ) { if ( isset ( $ this -> { $ objectName } -> { $ fieldName } ) ) { $ this -> out [ $ fieldName ] = ( double ) trim ( $ this -> { $ objectName } -> { $ fieldName } ) ; } else { $ this -> out [ $ fieldName ] = ( double ) $ default ; } return $ this ; } | Common Reading of a Single Double Field |
20,247 | protected function getSimpleBit ( $ fieldName , $ position , $ objectName = "object" , $ default = false ) { if ( isset ( $ this -> { $ objectName } -> { $ fieldName } ) ) { $ this -> out [ $ fieldName ] = ( bool ) ( ( $ this -> { $ objectName } -> { $ fieldName } >> $ position ) & 1 ) ; } else { $ this -> out [ $ fieldName ] = ( bool ) $ default ; } return $ this ; } | Common Reading of a Single Bit Field |
20,248 | protected function setSimpleFloat ( $ fieldName , $ fieldData , $ objectName = "object" ) { if ( ! isset ( $ this -> { $ objectName } -> { $ fieldName } ) || ( abs ( $ this -> { $ objectName } -> { $ fieldName } - $ fieldData ) > 1E-6 ) ) { $ this -> { $ objectName } -> { $ fieldName } = $ fieldData ; $ this -> needUpdate ( $ objectName ) ; } return $ this ; } | Common Writing of a Single Field |
20,249 | protected function setSimpleBit ( $ fieldName , $ position , $ fieldData , $ objectName = "object" ) { if ( $ this -> getSimpleBit ( $ fieldName , $ position , $ objectName ) !== $ fieldData ) { if ( $ fieldData ) { $ this -> { $ objectName } -> { $ fieldName } = $ this -> { $ objectName } -> { $ fieldName } | ( 1 << $ position ) ; } else { $ this -> { $ objectName } -> { $ fieldName } = $ this -> { $ objectName } -> { $ fieldName } & ~ ( 1 << $ position ) ; } $ this -> needUpdate ( $ objectName ) ; } return $ this ; } | Common Writing of a Single Bit Field |
20,250 | public function addPaymentTransaction ( PaymentTransaction $ paymentTransaction ) { if ( ! $ this -> hasPaymentTransaction ( $ paymentTransaction ) ) { $ this -> paymentTransactions [ ] = $ paymentTransaction ; } if ( $ paymentTransaction -> getPayment ( ) !== $ this ) { $ paymentTransaction -> setPayment ( $ this ) ; } return $ this ; } | Add payment transaction |
20,251 | protected function sizeBetween ( $ lengthValue , $ min , $ max , $ not = true ) { if ( ! ( $ lengthValue <= $ max && $ lengthValue >= $ min ) && $ not ) { $ this -> addReturn ( 'image_dimensions_width' , 'width' , [ ':min' => $ min , ':max' => $ max ] ) ; } elseif ( $ lengthValue <= $ max && $ lengthValue >= $ min && ! $ not ) { $ this -> addReturn ( 'image_dimensions_width' , 'not_width' , [ ':min' => $ min , ':max' => $ max ] ) ; } } | Test la largeur d une image . |
20,252 | public static function touchRemoteFile ( $ imageUrl ) { $ curl = curl_init ( $ imageUrl ) ; if ( ! $ curl ) { return false ; } curl_setopt_array ( $ curl , array ( CURLOPT_RETURNTRANSFER => 1 , CURLOPT_URL => $ imageUrl , CURLOPT_USERAGENT => 'Splash cURL Agent' ) ) ; $ resp = curl_exec ( $ curl ) ; curl_close ( $ curl ) ; return ( false != $ resp ) ; } | Uses CURL to GET Remote Image Once |
20,253 | private static function getRemoteFileSize ( $ imageUrl ) { $ result = curl_init ( $ imageUrl ) ; if ( ! $ result ) { return 0 ; } curl_setopt ( $ result , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ result , CURLOPT_HEADER , true ) ; curl_setopt ( $ result , CURLOPT_NOBODY , true ) ; curl_exec ( $ result ) ; $ imageSize = curl_getinfo ( $ result , CURLINFO_CONTENT_LENGTH_DOWNLOAD ) ; curl_close ( $ result ) ; return ( int ) $ imageSize ; } | Ues CURL to detect Remote Image Size |
20,254 | public static function configuration ( ) { if ( isset ( self :: core ( ) -> conf ) ) { return self :: core ( ) -> conf ; } self :: core ( ) -> conf = new ArrayObject ( array ( ) , ArrayObject :: ARRAY_AS_PROPS ) ; $ config = & self :: core ( ) -> conf ; $ config -> DefaultLanguage = SPLASH_DF_LANG ; $ config -> WsMethod = SPLASH_WS_METHOD ; $ config -> WsTimout = SPLASH_TIMEOUT ; $ config -> WsCrypt = SPLASH_CRYPT_METHOD ; $ config -> WsEncode = SPLASH_ENCODE ; $ config -> WsHost = 'www.splashsync.com/ws/soap' ; $ config -> Logging = SPLASH_LOGGING ; $ config -> TraceIn = SPLASH_TRACE_IN ; $ config -> TraceOut = SPLASH_TRACE_OUT ; $ config -> TraceTasks = SPLASH_TRACE_TASKS ; $ config -> Configurator = JsonConfigurator :: class ; $ config -> server = array ( ) ; $ localConf = self :: local ( ) -> Parameters ( ) ; if ( self :: validate ( ) -> isValidLocalParameterArray ( $ localConf ) ) { foreach ( $ localConf as $ key => $ value ) { $ config -> { $ key } = trim ( $ value ) ; } } $ customConf = self :: configurator ( ) -> getParameters ( ) ; foreach ( $ customConf as $ key => $ value ) { $ config -> { $ key } = trim ( $ value ) ; } return self :: core ( ) -> conf ; } | Get Configuration Array |
20,255 | public static function log ( ) { if ( ! isset ( self :: core ( ) -> log ) ) { self :: core ( ) -> log = new Logger ( ) ; if ( isset ( self :: configuration ( ) -> localname ) ) { self :: core ( ) -> log -> setPrefix ( self :: configuration ( ) -> localname ) ; } } return self :: core ( ) -> log ; } | Get a singleton Log Class Acces to Module Logging Functions |
20,256 | public static function com ( ) { if ( isset ( self :: core ( ) -> com ) ) { return self :: core ( ) -> com ; } switch ( self :: configuration ( ) -> WsMethod ) { case 'SOAP' : self :: log ( ) -> deb ( 'Selected SOAP PHP Protocol for Communication' ) ; self :: core ( ) -> com = new \ Splash \ Components \ SOAP \ SOAPInterface ( ) ; break ; case 'NuSOAP' : default : self :: log ( ) -> deb ( 'Selected NuSOAP PHP Librarie for Communication' ) ; self :: core ( ) -> com = new \ Splash \ Components \ NuSOAP \ NuSOAPInterface ( ) ; break ; } return self :: core ( ) -> com ; } | Get a singleton Communication Class |
20,257 | public static function ws ( ) { if ( ! isset ( self :: core ( ) -> soap ) ) { self :: core ( ) -> soap = new Webservice ( ) ; self :: core ( ) -> soap -> setup ( ) ; self :: translator ( ) -> load ( 'ws' ) ; } return self :: core ( ) -> soap ; } | Get a singleton WebService Class Acces to NuSOAP WebService Communication Functions |
20,258 | public static function router ( ) { if ( isset ( self :: core ( ) -> router ) ) { return self :: core ( ) -> router ; } self :: core ( ) -> router = new Router ( ) ; return self :: core ( ) -> router ; } | Get a singleton Router Class Acces to Server Tasking Management Functions |
20,259 | public static function file ( ) { if ( ! isset ( self :: core ( ) -> file ) ) { self :: core ( ) -> file = new FileManager ( ) ; self :: translator ( ) -> load ( 'file' ) ; } return self :: core ( ) -> file ; } | Get a singleton File Class Acces to File Management Functions |
20,260 | public static function validate ( ) { if ( isset ( self :: core ( ) -> valid ) ) { return self :: core ( ) -> valid ; } self :: core ( ) -> valid = new Validator ( ) ; self :: translator ( ) -> load ( 'ws' ) ; self :: translator ( ) -> load ( 'validate' ) ; return self :: core ( ) -> valid ; } | Get a singleton Validate Class Acces to Module Validation Functions |
20,261 | public static function xml ( ) { if ( isset ( self :: core ( ) -> xml ) ) { return self :: core ( ) -> xml ; } self :: core ( ) -> xml = new XmlManager ( ) ; return self :: core ( ) -> xml ; } | Get a singleton Xml Parser Class Acces to Module Xml Parser Functions |
20,262 | public static function translator ( ) { if ( ! isset ( self :: core ( ) -> translator ) ) { self :: core ( ) -> translator = new Translator ( ) ; } return self :: core ( ) -> translator ; } | Get a singleton Translator Class Acces to Translation Functions |
20,263 | public static function local ( ) { if ( isset ( self :: core ( ) -> localcore ) ) { return self :: core ( ) -> localcore ; } if ( ! self :: validate ( ) -> isValidLocalClass ( ) ) { throw new Exception ( 'You requested access to Local Class, but it is Invalid...' ) ; } self :: core ( ) -> localcore = new Local ( ) ; self :: translator ( ) -> load ( 'local' ) ; self :: core ( ) -> localcore -> Includes ( ) ; return self :: core ( ) -> localcore ; } | Acces Server Local Class |
20,264 | public static function object ( $ objectType ) { if ( ! isset ( self :: core ( ) -> objects ) ) { self :: core ( ) -> objects = array ( ) ; } if ( array_key_exists ( $ objectType , self :: core ( ) -> objects ) ) { return self :: core ( ) -> objects [ $ objectType ] ; } if ( ! self :: validate ( ) -> isValidObject ( $ objectType ) ) { throw new Exception ( 'You requested access to an Invalid Object Type : ' . $ objectType ) ; } if ( self :: local ( ) instanceof ObjectsProviderInterface ) { self :: core ( ) -> objects [ $ objectType ] = self :: local ( ) -> object ( $ objectType ) ; } else { $ className = SPLASH_CLASS_PREFIX . '\\Objects\\' . $ objectType ; self :: core ( ) -> objects [ $ objectType ] = new $ className ( ) ; } self :: translator ( ) -> load ( 'objects' ) ; return self :: core ( ) -> objects [ $ objectType ] ; } | Get Specific Object Class This function is a router for all local object classes & functions |
20,265 | public static function widget ( $ widgetType ) { if ( ! isset ( self :: core ( ) -> widgets ) ) { self :: core ( ) -> widgets = array ( ) ; } if ( array_key_exists ( $ widgetType , self :: core ( ) -> widgets ) ) { return self :: core ( ) -> widgets [ $ widgetType ] ; } if ( ! self :: validate ( ) -> isValidWidget ( $ widgetType ) ) { throw new Exception ( 'You requested access to an Invalid Widget Type : ' . $ widgetType ) ; } if ( self :: local ( ) instanceof WidgetsProviderInterface ) { self :: core ( ) -> widgets [ $ widgetType ] = self :: local ( ) -> widget ( $ widgetType ) ; } else { $ className = SPLASH_CLASS_PREFIX . '\\Widgets\\' . $ widgetType ; self :: core ( ) -> widgets [ $ widgetType ] = new $ className ( ) ; } self :: translator ( ) -> load ( 'widgets' ) ; return self :: core ( ) -> widgets [ $ widgetType ] ; } | Get Specific Widget Class This function is a router for all local widgets classes & functions |
20,266 | public static function configurator ( ) { if ( isset ( self :: core ( ) -> configurator ) ) { return self :: core ( ) -> configurator ; } $ className = self :: configuration ( ) -> Configurator ; if ( ! is_string ( $ className ) || empty ( $ className ) ) { return new NullConfigurator ( ) ; } if ( false == self :: validate ( ) -> isValidConfigurator ( $ className ) ) { return new NullConfigurator ( ) ; } self :: core ( ) -> configurator = new $ className ( ) ; return self :: core ( ) -> configurator ; } | Get Configurator Parser Instance |
20,267 | public static function reboot ( ) { if ( isset ( self :: core ( ) -> conf ) ) { self :: core ( ) -> conf = null ; } if ( isset ( self :: core ( ) -> soap ) ) { self :: core ( ) -> soap = null ; } if ( isset ( self :: core ( ) -> objects ) ) { self :: core ( ) -> objects = null ; } self :: log ( ) -> cleanLog ( ) ; self :: log ( ) -> deb ( 'Splash Module Rebooted' ) ; } | Fully Restart Splash Module |
20,268 | public static function getLocalPath ( ) { if ( null == self :: local ( ) ) { return null ; } $ reflector = new \ ReflectionClass ( get_class ( self :: local ( ) ) ) ; return dirname ( ( string ) $ reflector -> getFileName ( ) ) ; } | Detect Real Path of Current Module Local Class |
20,269 | public static function input ( $ name , $ type = INPUT_SERVER ) { $ result = filter_input ( $ type , $ name ) ; if ( null !== $ result ) { return $ result ; } if ( ( INPUT_SERVER === $ type ) && isset ( $ _SERVER [ $ name ] ) ) { return $ _SERVER [ $ name ] ; } if ( ( INPUT_GET === $ type ) && isset ( $ _GET [ $ name ] ) ) { return $ _GET [ $ name ] ; } return null ; } | Secured reading of Server SuperGlobals |
20,270 | public static function informations ( ) { $ response = new ArrayObject ( array ( ) , ArrayObject :: ARRAY_AS_PROPS ) ; $ response -> shortdesc = SPLASH_NAME . ' ' . SPLASH_VERSION ; $ response -> longdesc = SPLASH_DESC ; $ response -> company = null ; $ response -> address = null ; $ response -> zip = null ; $ response -> town = null ; $ response -> country = null ; $ response -> www = null ; $ response -> email = null ; $ response -> phone = null ; $ response -> icoraw = self :: file ( ) -> readFileContents ( dirname ( dirname ( __FILE__ ) ) . '/img/Splash-ico.png' ) ; $ response -> logourl = null ; $ response -> logoraw = self :: file ( ) -> readFileContents ( dirname ( dirname ( __FILE__ ) ) . '/img/Splash-ico.jpg' ) ; $ response -> servertype = SPLASH_NAME ; $ response -> serverurl = filter_input ( INPUT_SERVER , 'SERVER_NAME' ) ; $ response -> moduleauthor = SPLASH_AUTHOR ; $ response -> moduleversion = SPLASH_VERSION ; if ( ! self :: validate ( ) -> isValidLocalClass ( ) ) { return $ response ; } $ localArray = self :: local ( ) -> informations ( $ response ) ; if ( ! ( $ localArray instanceof ArrayObject ) ) { $ response = $ localArray ; } return $ response ; } | Ask for Server System Informations Informations may be overwritten by Local Module Class |
20,271 | public static function objects ( ) { if ( self :: local ( ) instanceof ObjectsProviderInterface ) { return self :: local ( ) -> objects ( ) ; } $ objectsList = array ( ) ; $ path = self :: getLocalPath ( ) . '/Objects' ; if ( ! is_dir ( $ path ) ) { return $ objectsList ; } $ scan = scandir ( $ path , 1 ) ; if ( false == $ scan ) { return $ objectsList ; } $ files = array_diff ( $ scan , array ( '..' , '.' , 'index.php' , 'index.html' ) ) ; foreach ( $ files as $ filename ) { if ( ! is_file ( $ path . '/' . $ filename ) ) { continue ; } $ className = pathinfo ( $ path . '/' . $ filename , PATHINFO_FILENAME ) ; if ( false == self :: validate ( ) -> isValidObject ( $ className ) ) { continue ; } $ objectsList [ ] = $ className ; } return $ objectsList ; } | Build list of Available Objects |
20,272 | public static function widgets ( ) { if ( self :: local ( ) instanceof WidgetsProviderInterface ) { return self :: local ( ) -> widgets ( ) ; } $ widgetTypes = array ( ) ; $ path = self :: getLocalPath ( ) . '/Widgets' ; if ( ! is_dir ( $ path ) ) { return $ widgetTypes ; } $ scan = scandir ( $ path , 1 ) ; if ( false == $ scan ) { return $ widgetTypes ; } $ files = array_diff ( $ scan , array ( '..' , '.' , 'index.php' , 'index.html' ) ) ; foreach ( $ files as $ filename ) { $ className = pathinfo ( $ path . '/' . $ filename , PATHINFO_FILENAME ) ; if ( false == self :: validate ( ) -> isValidWidget ( $ className ) ) { continue ; } $ widgetTypes [ ] = $ className ; } return $ widgetTypes ; } | Build list of Available Widgets |
20,273 | public function serializeEnvelope ( $ body , $ headers = false , $ namespaces = array ( ) , $ style = 'rpc' , $ use = 'encoded' , $ encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/' ) { $ this -> debug ( "In serializeEnvelope length=" . strlen ( $ body ) . " body (max 1000 characters)=" . substr ( $ body , 0 , 1000 ) . " style=$style use=$use encodingStyle=$encodingStyle" ) ; $ this -> debug ( "headers:" ) ; $ this -> appendDebug ( $ this -> varDump ( $ headers ) ) ; $ this -> debug ( "namespaces:" ) ; $ this -> appendDebug ( $ this -> varDump ( $ namespaces ) ) ; $ ns_string = '' ; foreach ( array_merge ( $ this -> namespaces , $ namespaces ) as $ k => $ v ) { $ ns_string .= " xmlns:$k=\"$v\"" ; } if ( $ encodingStyle ) { $ ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string" ; } if ( $ headers ) { if ( is_array ( $ headers ) ) { $ xml = '' ; foreach ( $ headers as $ k => $ v ) { if ( is_object ( $ v ) && get_class ( $ v ) == 'soapval' ) { $ xml .= $ this -> serialize_val ( $ v , false , false , false , false , false , $ use ) ; } else { $ xml .= $ this -> serialize_val ( $ v , $ k , false , false , false , false , $ use ) ; } } $ headers = $ xml ; $ this -> debug ( "In serializeEnvelope, serialized array of headers to $headers" ) ; } $ headers = "<SOAP-ENV:Header>" . $ headers . "</SOAP-ENV:Header>" ; } return '<?xml version="1.0" encoding="' . $ this -> soap_defencoding . '"?' . ">" . '<SOAP-ENV:Envelope' . $ ns_string . ">" . $ headers . "<SOAP-ENV:Body>" . $ body . "</SOAP-ENV:Body>" . "</SOAP-ENV:Envelope>" ; } | serializes a message |
20,274 | public function serialize ( ) { $ ns_string = '' ; foreach ( $ this -> namespaces as $ k => $ v ) { $ ns_string .= "\n xmlns:$k=\"$v\"" ; } $ return_msg = '<?xml version="1.0" encoding="' . $ this -> soap_defencoding . '"?>' . '<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"' . $ ns_string . ">\n" . '<SOAP-ENV:Body>' . '<SOAP-ENV:Fault>' . $ this -> serialize_val ( $ this -> faultcode , 'faultcode' ) . $ this -> serialize_val ( $ this -> faultactor , 'faultactor' ) . $ this -> serialize_val ( $ this -> faultstring , 'faultstring' ) . $ this -> serialize_val ( $ this -> faultdetail , 'detail' ) . '</SOAP-ENV:Fault>' . '</SOAP-ENV:Body>' . '</SOAP-ENV:Envelope>' ; return $ return_msg ; } | serialize a fault |
20,275 | public function parseString ( $ xml , $ type ) { if ( $ xml != "" ) { $ this -> parser = xml_parser_create ( ) ; xml_parser_set_option ( $ this -> parser , XML_OPTION_CASE_FOLDING , 0 ) ; xml_set_object ( $ this -> parser , $ this ) ; if ( $ type == "schema" ) { xml_set_element_handler ( $ this -> parser , 'schemaStartElement' , 'schemaEndElement' ) ; xml_set_character_data_handler ( $ this -> parser , 'schemaCharacterData' ) ; } elseif ( $ type == "xml" ) { xml_set_element_handler ( $ this -> parser , 'xmlStartElement' , 'xmlEndElement' ) ; xml_set_character_data_handler ( $ this -> parser , 'xmlCharacterData' ) ; } if ( ! xml_parse ( $ this -> parser , $ xml , true ) ) { $ errstr = sprintf ( 'XML error parsing XML schema on line %d: %s' , xml_get_current_line_number ( $ this -> parser ) , xml_error_string ( xml_get_error_code ( $ this -> parser ) ) ) ; $ this -> debug ( $ errstr ) ; $ this -> debug ( "XML payload:\n" . $ xml ) ; $ this -> setError ( $ errstr ) ; } xml_parser_free ( $ this -> parser ) ; } else { $ this -> debug ( 'no xml passed to parseString()!!' ) ; $ this -> setError ( 'no xml passed to parseString()!!' ) ; } } | parse an XML string |
20,276 | public function CreateTypeName ( $ ename ) { $ scope = '' ; for ( $ i = 0 ; $ i < count ( $ this -> complexTypeStack ) ; $ i ++ ) { $ scope .= $ this -> complexTypeStack [ $ i ] . '_' ; } return $ scope . $ ename . '_ContainedType' ; } | gets a type name for an unnamed type |
20,277 | public function addElement ( $ attrs ) { if ( ! $ this -> getPrefix ( $ attrs [ 'type' ] ) ) { $ attrs [ 'type' ] = $ this -> schemaTargetNamespace . ':' . $ attrs [ 'type' ] ; } $ this -> elements [ $ attrs [ 'name' ] ] = $ attrs ; $ this -> elements [ $ attrs [ 'name' ] ] [ 'typeClass' ] = 'element' ; $ this -> xdebug ( "addElement " . $ attrs [ 'name' ] ) ; $ this -> appendDebug ( $ this -> varDump ( $ this -> elements [ $ attrs [ 'name' ] ] ) ) ; } | adds an element to the schema |
20,278 | public function serialize ( $ use = 'encoded' ) { return $ this -> serialize_val ( $ this -> value , $ this -> name , $ this -> type , $ this -> element_ns , $ this -> type_ns , $ this -> attributes , $ use , true ) ; } | return serialized value |
20,279 | public function setCurlOption ( $ option , $ value ) { $ this -> debug ( "setCurlOption option=$option, value=" ) ; $ this -> appendDebug ( $ this -> varDump ( $ value ) ) ; curl_setopt ( $ this -> ch , $ option , $ value ) ; } | sets a cURL option |
20,280 | public function unsetHeader ( $ name ) { if ( isset ( $ this -> outgoing_headers [ $ name ] ) ) { $ this -> debug ( "unset header $name" ) ; unset ( $ this -> outgoing_headers [ $ name ] ) ; } } | unsets an HTTP header |
20,281 | public function addComplexType ( $ name , $ typeClass = 'complexType' , $ phpType = 'array' , $ compositor = '' , $ restrictionBase = '' , $ elements = array ( ) , $ attrs = array ( ) , $ arrayType = '' ) { if ( count ( $ elements ) > 0 ) { $ eElements = array ( ) ; foreach ( $ elements as $ n => $ e ) { $ ee = array ( ) ; foreach ( $ e as $ k => $ v ) { $ k = strpos ( $ k , ':' ) ? $ this -> expandQname ( $ k ) : $ k ; $ v = strpos ( $ v , ':' ) ? $ this -> expandQname ( $ v ) : $ v ; $ ee [ $ k ] = $ v ; } $ eElements [ $ n ] = $ ee ; } $ elements = $ eElements ; } if ( count ( $ attrs ) > 0 ) { foreach ( $ attrs as $ n => $ a ) { foreach ( $ a as $ k => $ v ) { $ k = strpos ( $ k , ':' ) ? $ this -> expandQname ( $ k ) : $ k ; $ v = strpos ( $ v , ':' ) ? $ this -> expandQname ( $ v ) : $ v ; $ aa [ $ k ] = $ v ; } $ eAttrs [ $ n ] = $ aa ; } $ attrs = $ eAttrs ; } $ restrictionBase = strpos ( $ restrictionBase , ':' ) ? $ this -> expandQname ( $ restrictionBase ) : $ restrictionBase ; $ arrayType = strpos ( $ arrayType , ':' ) ? $ this -> expandQname ( $ arrayType ) : $ arrayType ; $ typens = isset ( $ this -> namespaces [ 'types' ] ) ? $ this -> namespaces [ 'types' ] : $ this -> namespaces [ 'tns' ] ; $ this -> schemas [ $ typens ] [ 0 ] -> addComplexType ( $ name , $ typeClass , $ phpType , $ compositor , $ restrictionBase , $ elements , $ attrs , $ arrayType ) ; } | adds an XML Schema complex type to the WSDL types |
20,282 | public function checkWSDL ( ) { $ this -> appendDebug ( $ this -> wsdl -> getDebug ( ) ) ; $ this -> wsdl -> clearDebug ( ) ; $ this -> debug ( 'checkWSDL' ) ; if ( $ errstr = $ this -> wsdl -> getError ( ) ) { $ this -> appendDebug ( $ this -> wsdl -> getDebug ( ) ) ; $ this -> wsdl -> clearDebug ( ) ; $ this -> debug ( 'got wsdl error: ' . $ errstr ) ; $ this -> setError ( 'wsdl error: ' . $ errstr ) ; } elseif ( $ this -> operations = $ this -> wsdl -> getOperations ( $ this -> portName , 'soap' ) ) { $ this -> appendDebug ( $ this -> wsdl -> getDebug ( ) ) ; $ this -> wsdl -> clearDebug ( ) ; $ this -> bindingType = 'soap' ; $ this -> debug ( 'got ' . count ( $ this -> operations ) . ' operations from wsdl ' . $ this -> wsdlFile . ' for binding type ' . $ this -> bindingType ) ; } elseif ( $ this -> operations = $ this -> wsdl -> getOperations ( $ this -> portName , 'soap12' ) ) { $ this -> appendDebug ( $ this -> wsdl -> getDebug ( ) ) ; $ this -> wsdl -> clearDebug ( ) ; $ this -> bindingType = 'soap12' ; $ this -> debug ( 'got ' . count ( $ this -> operations ) . ' operations from wsdl ' . $ this -> wsdlFile . ' for binding type ' . $ this -> bindingType ) ; $ this -> debug ( '**************** WARNING: SOAP 1.2 BINDING *****************' ) ; } else { $ this -> appendDebug ( $ this -> wsdl -> getDebug ( ) ) ; $ this -> wsdl -> clearDebug ( ) ; $ this -> debug ( 'getOperations returned false' ) ; $ this -> setError ( 'no operations defined in the WSDL document!' ) ; } } | check WSDL passed as an instance or pulled from an endpoint |
20,283 | public function loadWSDL ( ) { $ this -> debug ( 'instantiating wsdl class with doc: ' . $ this -> wsdlFile ) ; $ this -> wsdl = new wsdl ( '' , $ this -> proxyhost , $ this -> proxyport , $ this -> proxyusername , $ this -> proxypassword , $ this -> timeout , $ this -> response_timeout , $ this -> curl_options , $ this -> use_curl ) ; $ this -> wsdl -> setCredentials ( $ this -> username , $ this -> password , $ this -> authtype , $ this -> certRequest ) ; $ this -> wsdl -> fetchWSDL ( $ this -> wsdlFile ) ; $ this -> checkWSDL ( ) ; } | instantiate wsdl object and parse wsdl file |
20,284 | public function checkCookies ( ) { if ( sizeof ( $ this -> cookies ) == 0 ) { return true ; } $ this -> debug ( 'checkCookie: check ' . sizeof ( $ this -> cookies ) . ' cookies' ) ; $ curr_cookies = $ this -> cookies ; $ this -> cookies = array ( ) ; foreach ( $ curr_cookies as $ cookie ) { if ( ! is_array ( $ cookie ) ) { $ this -> debug ( 'Remove cookie that is not an array' ) ; continue ; } if ( ( isset ( $ cookie [ 'expires' ] ) ) && ( ! empty ( $ cookie [ 'expires' ] ) ) ) { if ( strtotime ( $ cookie [ 'expires' ] ) > time ( ) ) { $ this -> cookies [ ] = $ cookie ; } else { $ this -> debug ( 'Remove expired cookie ' . $ cookie [ 'name' ] ) ; } } else { $ this -> cookies [ ] = $ cookie ; } } $ this -> debug ( 'checkCookie: ' . sizeof ( $ this -> cookies ) . ' cookies left in array' ) ; return true ; } | checks all Cookies and delete those which are expired |
20,285 | private function addRoute ( $ method , $ uri , $ controller , $ action ) { if ( strlen ( $ this -> prefixUri ) > 0 ) { $ uri = $ this -> prefixUri . $ uri ; $ this -> prefixUri = '' ; } if ( strrpos ( $ controller , '\\' , 1 ) === false ) { $ controller = 'App\\Controllers\\' . $ controller ; } $ items = $ uri ? explode ( '/' , ltrim ( $ uri , '/' ) ) : [ ] ; $ this -> routes [ ] = [ 'method' => $ method , 'count' => count ( $ items ) , 'controller' => $ controller , 'action' => $ action , 'params' => $ items , ] ; } | Base function register routes |
20,286 | public function findWebSocketRoute ( ) { $ pathinfo = ! empty ( $ _SERVER [ 'PATH_INFO' ] ) && $ _SERVER [ 'PATH_INFO' ] != '/' ? $ _SERVER [ 'PATH_INFO' ] : '/index' ; foreach ( $ this -> routes as $ value ) { if ( $ value [ 'method' ] == 'WEBSOCKET' ) { $ route_uri = '/' . implode ( '/' , $ value [ 'params' ] ) ; if ( $ pathinfo === $ route_uri ) { return $ value [ 'controller' ] ; } } } return '' ; } | Find One websocket by controller handler name |
20,287 | public function head ( string $ uri , string $ controller , string $ action ) { $ this -> addRoute ( 'HEAD' , $ uri , $ controller , $ action ) ; } | Register a new HEAD route with the router . |
20,288 | public function websocket ( string $ uri , string $ controller ) { $ this -> addRoute ( 'WEBSOCKET' , $ uri , $ controller , null ) ; } | Register a new WebSocket route with the router . |
20,289 | public function all ( string $ uri , string $ controller , string $ action ) { $ this -> addRoute ( 'ALL' , $ uri , $ controller , $ action ) ; } | Register a new router with any http METHOD |
20,290 | public function from ( $ email , $ name = '' ) { $ value = $ this -> parseMail ( $ this -> filtreEmail ( $ email ) , $ this -> filtreName ( $ name ) ) ; return $ this -> withHeader ( 'from' , $ value ) ; } | Ajoute une adresse de provenance . |
20,291 | public function send ( ) { $ to = $ this -> getHeaderLine ( 'to' ) ; $ subject = $ this -> subject ; $ message = $ this -> message ; return mail ( $ to , $ subject , $ message , $ this -> parseHeaders ( ) ) ; } | Envoie l email . |
20,292 | protected function updatePaymentTransaction ( PaymentTransaction $ paymentTransaction , CallbackResponse $ callbackResponse ) { $ paymentTransaction -> setStatus ( $ callbackResponse -> getStatus ( ) ) ; $ paymentTransaction -> getPayment ( ) -> setPaynetId ( $ callbackResponse -> getPaymentPaynetId ( ) ) ; if ( $ callbackResponse -> isError ( ) || $ callbackResponse -> isDeclined ( ) ) { $ paymentTransaction -> addError ( $ callbackResponse -> getError ( ) ) ; } } | Updates Payment transaction by Callback data |
20,293 | protected function validateSignature ( PaymentTransaction $ paymentTransaction , CallbackResponse $ callbackResponse ) { $ expectedControlCode = sha1 ( $ callbackResponse -> getStatus ( ) . $ callbackResponse -> getPaymentPaynetId ( ) . $ callbackResponse -> getPaymentClientId ( ) . $ paymentTransaction -> getQueryConfig ( ) -> getSigningKey ( ) ) ; if ( $ expectedControlCode !== $ callbackResponse -> getControlCode ( ) ) { throw new ValidationException ( "Actual control code '{$callbackResponse->getControlCode()}' does " . "not equal expected '{$expectedControlCode}'" ) ; } } | Validate callback response control code |
20,294 | public static function fieldsFactory ( ) { if ( isset ( self :: $ fields ) ) { return self :: $ fields ; } self :: $ fields = new FieldsFactory ( ) ; Splash :: translator ( ) -> load ( "objects" ) ; return self :: $ fields ; } | Get a singleton FieldsFactory Class Acces to Object Fields Creation Functions |
20,295 | public static function blocksFactory ( ) { if ( isset ( self :: $ blocks ) ) { return self :: $ blocks ; } self :: $ blocks = new BlocksFactory ( ) ; return self :: $ blocks ; } | Get a singleton BlocksFactory Class Acces to Widgets Contents Blocks Functions |
20,296 | public function description ( ) { Splash :: log ( ) -> trace ( ) ; return array ( "type" => $ this -> getType ( ) , "name" => $ this -> getName ( ) , "description" => $ this -> getDesc ( ) , "icon" => $ this -> getIcon ( ) , "disabled" => $ this -> getIsDisabled ( ) , "options" => $ this -> getOptions ( ) , "parameters" => $ this -> getParameters ( ) , ) ; } | Get Definition Array for requested Widget Type |
20,297 | protected function defineAttributes ( NodeBuilder $ builder ) { $ builder -> arrayNode ( 'attributes' ) -> useAttributeAsKey ( '' ) -> prototype ( 'array' ) -> children ( ) -> scalarNode ( 'type' ) -> cannotBeEmpty ( ) -> end ( ) -> scalarNode ( 'getter' ) -> cannotBeEmpty ( ) -> end ( ) -> scalarNode ( 'setter' ) -> cannotBeEmpty ( ) -> end ( ) -> booleanNode ( 'processNull' ) -> defaultFalse ( ) -> end ( ) ; } | Define attributes section of configuration |
20,298 | protected function defineRelationships ( NodeBuilder $ builder ) { $ relationships = $ builder -> arrayNode ( 'relationships' ) -> useAttributeAsKey ( '' ) -> prototype ( 'array' ) -> children ( ) -> enumNode ( 'type' ) -> values ( [ 'one' , 'many' ] ) -> cannotBeEmpty ( ) -> defaultValue ( 'one' ) -> end ( ) -> scalarNode ( 'getter' ) -> cannotBeEmpty ( ) -> end ( ) -> booleanNode ( 'dataAllowed' ) -> defaultFalse ( ) -> end ( ) -> integerNode ( 'dataLimit' ) -> defaultValue ( 0 ) -> end ( ) ; $ this -> defineLinks ( $ relationships ) ; } | Define relationships section of configuration |
20,299 | protected function defineLinks ( NodeBuilder $ builder ) { $ builder -> arrayNode ( 'links' ) -> useAttributeAsKey ( '' ) -> prototype ( 'array' ) -> children ( ) -> scalarNode ( 'resource' ) -> isRequired ( ) -> cannotBeEmpty ( ) -> end ( ) -> arrayNode ( 'parameters' ) -> prototype ( 'scalar' ) -> end ( ) -> end ( ) -> arrayNode ( 'metadata' ) -> prototype ( 'scalar' ) -> end ( ) -> end ( ) ; } | Define links section of configuration |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.