idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
4,800 | protected function enumValuesFromCheckClause ( $ clause ) { $ segments = preg_split ( '/ +OR *\[/i' , $ clause ) ; $ constraints = array ( ) ; foreach ( $ segments as $ segment ) { $ bits = preg_split ( '/ *= */' , $ segment ) ; for ( $ i = 1 ; $ i < sizeof ( $ bits ) ; $ i += 2 ) { array_unshift ( $ constraints , subs... | Get enum values from a constraint check clause . |
4,801 | protected function getIndexSqlDefinition ( $ tableName , $ indexName , $ indexSpec ) { $ index = $ this -> buildMSSQLIndexName ( $ tableName , $ indexName ) ; $ indexSpec = $ this -> parseIndexSpec ( $ indexName , $ indexSpec ) ; $ drop = "IF EXISTS (SELECT name FROM sys.indexes WHERE name = '$index' AND object_id = ob... | Return SQL for dropping and recreating an index |
4,802 | public function indexList ( $ table ) { $ indexes = $ this -> query ( "EXEC sp_helpindex '$table';" ) ; $ indexList = array ( ) ; foreach ( $ indexes as $ index ) { if ( strpos ( $ index [ 'index_description' ] , 'unique' ) !== false ) { $ indexType = 'unique ' ; } else { $ indexType = 'index ' ; } $ baseIndexName = $ ... | Return the list of indexes in a table . |
4,803 | protected function connectDatabase ( $ database ) { $ parameters = $ this -> parameters ; $ parameters [ 'database' ] = $ database ; $ parameters [ 'multipleactiveresultsets' ] = 0 ; if ( empty ( $ parameters [ 'driver' ] ) ) { $ parameters [ 'driver' ] = $ this -> getDatabaseServer ( ) ; } $ this -> connector -> conne... | Connect to a database using the provided parameters |
4,804 | public function selectDatabase ( $ name , $ create = false , $ errorLevel = E_USER_ERROR ) { $ this -> fullTextEnabled = null ; if ( ! $ this -> schemaManager -> databaseExists ( $ name ) ) { if ( ! $ create ) { if ( $ errorLevel !== false ) { user_error ( "Attempted to connect to non-existing database \"$name\"" , $ e... | Switches to the given database . |
4,805 | public function fullTextSearchMSSQL ( $ tableName , $ keywords , $ fields = null ) { if ( isset ( $ fields ) && ! is_array ( $ fields ) ) { $ fields = array ( $ fields ) ; } if ( function_exists ( 'mb_ereg_replace' ) ) { $ keywords = mb_ereg_replace ( '[^\w\s]' , '' , trim ( $ keywords ) ) ; } else { $ keywords = $ thi... | Returns a SQL fragment for querying a fulltext search index |
4,806 | public function removeStopwords ( $ keywords ) { $ goodKeywords = array ( ) ; foreach ( $ keywords as $ keyword ) { if ( in_array ( $ keyword , self :: $ noiseWords ) ) { continue ; } $ goodKeywords [ ] = trim ( $ keyword ) ; } return $ goodKeywords ; } | Remove stopwords that would kill a MSSQL full - text query |
4,807 | public function supportsExtensions ( $ extensions = array ( 'partitions' , 'tablespaces' , 'clustering' ) ) { if ( isset ( $ extensions [ 'partitions' ] ) ) { return false ; } elseif ( isset ( $ extensions [ 'tablespaces' ] ) ) { return false ; } elseif ( isset ( $ extensions [ 'clustering' ] ) ) { return false ; } els... | This is a quick lookup to discover if the database supports particular extensions Currently MSSQL supports no extensions |
4,808 | public function transactionStart ( $ transactionMode = false , $ sessionCharacteristics = false ) { if ( $ this -> transactionNesting > 0 ) { $ this -> transactionSavepoint ( 'NESTEDTRANSACTION' . $ this -> transactionNesting ) ; } elseif ( $ this -> connector instanceof SQLServerConnector ) { $ this -> connector -> tr... | Start transaction . READ ONLY not supported . |
4,809 | public function formattedDatetimeClause ( $ date , $ format ) { preg_match_all ( '/%(.)/' , $ format , $ matches ) ; foreach ( $ matches [ 1 ] as $ match ) { if ( array_search ( $ match , array ( 'Y' , 'm' , 'd' , 'H' , 'i' , 's' , 'U' ) ) === false ) { user_error ( 'formattedDatetimeClause(): unsupported format charac... | Function to return an SQL datetime expression for MSSQL used for querying a datetime in a certain format |
4,810 | public function datetimeIntervalClause ( $ date , $ interval ) { $ trans = array ( 'year' => 'yy' , 'month' => 'mm' , 'day' => 'dd' , 'hour' => 'hh' , 'minute' => 'mi' , 'second' => 'ss' , ) ; $ singularinterval = preg_replace ( '/(year|month|day|hour|minute|second)s/i' , '$1' , $ interval ) ; if ( ! ( $ params = preg_... | Function to return an SQL datetime expression for MSSQL . used for querying a datetime addition |
4,811 | public function datetimeDifferenceClause ( $ date1 , $ date2 ) { if ( preg_match ( '/^now$/i' , $ date1 ) ) { $ date1 = "CURRENT_TIMESTAMP" ; } elseif ( preg_match ( '/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/i' , $ date1 ) ) { $ date1 = "'$date1'" ; } if ( preg_match ( '/^now$/i' , $ date2 ) ) { $ date2 = "CURRENT_TIMEST... | Function to return an SQL datetime expression for MSSQL . used for querying a datetime substraction |
4,812 | public function regUser ( $ username , $ password , $ email , $ package , $ fistName , $ lastName ) { return $ this -> send ( 'v-add-user' , $ username , $ password , $ email , $ package , $ fistName , $ lastName ) ; } | Registration User . |
4,813 | public function showUserBackup ( $ backup ) { $ this -> returnCode = 'no' ; $ answer = $ this -> send ( 'v-list-user-backup' , $ this -> userName , $ backup , 'json' ) ; $ data = json_decode ( $ answer , true ) ; return $ data ; } | Show Backup . |
4,814 | protected function getTokenFromCookie ( ) { $ cookies = $ this -> getCookies ( ) ; if ( ! empty ( $ cookies [ 'token' ] ) && $ cookies [ 'token' ] [ 'expiration' ] > time ( ) ) { return $ cookies [ 'token' ] [ 'value' ] ; } return null ; } | Returns the authentication token . |
4,815 | public function getCookies ( ) : array { $ cookies = [ ] ; $ cookieFileName = $ this -> getCookieFileName ( ) ; if ( ! file_exists ( $ cookieFileName ) ) { return $ cookies ; } $ contents = file_get_contents ( $ cookieFileName ) ; $ lines = explode ( LF , $ contents ) ; foreach ( $ lines as $ line ) { if ( empty ( $ li... | Returns the available cookies . |
4,816 | protected function getCookieFileName ( ) : string { return $ this -> cookiePath . sha1 ( $ this -> username . chr ( 0 ) . $ this -> password . chr ( 0 ) . $ this -> userAgent ) ; } | Returns the cookie file name . |
4,817 | public function connect ( ) : bool { $ response = $ this -> doPost ( '/api/v2.0/users/oauth/token' , [ 'email' => $ this -> username , 'password' => $ this -> password ] ) ; $ this -> storeToken ( $ response [ 'accessToken' ] ) ; $ response = $ this -> doGet ( '/api/v2.0/users/me/cookie-from-access-token' ) ; return tr... | Connects to Doodle . |
4,818 | protected function doRequest ( string $ method , string $ relativeUrl , array $ data ) { $ url = 'https://doodle.com' . $ relativeUrl ; $ cookieFileName = $ this -> getCookieFileName ( ) ; $ dataQuery = '' ; if ( strpos ( $ relativeUrl , 'api' ) !== false ) { if ( ! empty ( $ data ) ) { $ dataQuery = json_encode ( $ da... | Sends a HTTP request to Doodle . |
4,819 | protected function storeToken ( string $ token ) { $ cookies = $ this -> getCookies ( ) ; $ cookies [ 'token' ] [ 'domain' ] = '.doodle.com' ; $ cookies [ 'token' ] [ 'truefalse' ] = 'TRUE' ; $ cookies [ 'token' ] [ 'path' ] = '/' ; $ cookies [ 'token' ] [ 'truefalse2' ] = 'FALSE' ; $ cookies [ 'token' ] [ 'something' ... | Stores the authentication token . |
4,820 | protected function persistCookies ( array $ cookies ) { $ cookieFileName = $ this -> getCookieFileName ( ) ; $ contents = <<<EOT# Netscape HTTP Cookie File# http://curl.haxx.se/docs/http-cookies.html# This file was generated by libcurl! Edit at your own risk.EOT ; foreach ( $ cookies as $ cookie ) { $ contents .= impl... | Persists cookies . |
4,821 | public function disconnect ( ) : bool { $ cookieFileName = $ this -> getCookieFileName ( ) ; if ( file_exists ( $ cookieFileName ) ) { return unlink ( $ cookieFileName ) ; } return false ; } | Disconnects from Doodle . |
4,822 | public function getUserInfo ( ) : array { $ data = [ 'isMobile' => 'false' , 'includeKalsysInfos' => 'false' , 'token' => $ this -> token , ] ; $ response = $ this -> doGet ( '/np/users/me' , $ data ) ; $ userInfo = json_decode ( $ response , true ) ; return $ userInfo ; } | Returns user information . |
4,823 | public function getPersonalPolls ( ) { $ data = [ 'fullList' => 'true' , 'locale' => $ this -> locale , 'token' => $ this -> token , ] ; $ response = $ this -> doGet ( '/np/users/me/dashboard/myPolls' , $ data ) ; if ( strpos ( $ response , '<title>Doodle: Not found' ) !== false ) { throw new \ Causal \ DoodleClient \ ... | Returns personal polls . |
4,824 | public function getOtherPolls ( ) { $ data = [ 'fullList' => 'true' , 'locale' => $ this -> locale , 'token' => $ this -> token , ] ; $ response = $ this -> doGet ( '/np/users/me/dashboard/otherPolls' , $ data ) ; $ polls = json_decode ( $ response , true ) ; $ objects = [ ] ; if ( ! empty ( $ polls [ 'otherPolls' ] [ ... | Returns other polls . |
4,825 | public function deletePoll ( Poll $ poll ) : bool { if ( empty ( $ poll -> getAdminKey ( ) ) ) { throw new \ Exception ( sprintf ( 'Admin key not available. Poll %s cannot be deleted.' , $ poll -> getId ( ) ) , 1443782170 ) ; } return $ this -> doDelete ( '/api/v2.0/polls/' . $ poll -> getId ( ) . '?adminKey=' . $ poll... | Deletes a poll . |
4,826 | public function deleteParticipant ( Poll $ poll , int $ participantid ) { if ( empty ( $ poll -> getAdminKey ( ) ) ) { throw new \ Exception ( sprintf ( 'Admin key not available. Poll %s cannot be deleted.' , $ poll -> getId ( ) ) , 1443782170 ) ; } return $ this -> doDelete ( '/api/v2.0/polls/' . $ poll -> getId ( ) .... | Deletes a participant . |
4,827 | public function listOnlyBD ( $ database ) { $ this -> returnCode = 'no' ; $ listBd = $ this -> send ( 'v-list-database' , $ this -> userName , $ database , 'json' ) ; $ data = json_decode ( $ listBd , true ) ; return $ data ; } | List Only BD . |
4,828 | public function addDateBase ( $ database , $ dbuser , $ password , $ type , $ charset ) { return $ this -> send ( 'v-add-database' , $ this -> userName , $ database , $ dbuser , $ password , $ type , 'localhost' , $ charset ) ; } | Add date base . |
4,829 | public static function stringify ( $ value ) { $ string = '' ; if ( is_scalar ( $ value ) ) { $ string = ( string ) $ value ; } elseif ( is_resource ( $ value ) ) { $ string = '[resource]' ; } else { $ string = json_encode ( $ value ) ; } return $ string ; } | Converts any PHP type to string |
4,830 | public function listCron ( ) { $ this -> returnCode = 'no' ; $ listDns = $ this -> send ( 'v-list-cron-jobs' , $ this -> userName , 'json' ) ; $ data = json_decode ( $ listDns , true ) ; return $ data ; } | Cron list . |
4,831 | public function addCron ( $ min , $ hour , $ day , $ month , $ wday , $ cmd ) { return $ this -> send ( 'v-add-cron-job' , $ this -> userName , $ min , $ hour , $ day , $ month , $ wday , $ cmd ) ; } | Add Cron . |
4,832 | public function showCron ( $ job ) { $ this -> returnCode = 'no' ; $ request = $ this -> send ( 'v-list-cron-job' , $ this -> userName , $ job , 'json' ) ; $ data = json_decode ( $ request , true ) ; return $ data ; } | Show Cron . |
4,833 | public function editCron ( $ job , $ min , $ hour , $ day , $ month , $ wday , $ cmd ) { return $ this -> send ( 'v-change-cron-job' , $ this -> userName , $ job , $ min , $ hour , $ day , $ month , $ wday , $ cmd ) ; } | Edit cron . |
4,834 | public function addFtpDomain ( $ domain , $ ftpUserName , $ ftpPassword , $ ftpPath ) { return $ this -> send ( 'v-add-web-domain-ftp' , $ this -> userName , $ domain , $ ftpUserName , $ ftpPassword , $ ftpPath ) ; } | Add FTP domain . |
4,835 | public function changeWebDomain ( $ domain , $ ftpUserName , $ ftpPath ) { return $ this -> send ( 'v-change-web-domain-ftp-path' , $ this -> userName , $ domain , $ ftpUserName , $ ftpPath ) ; } | Change web domain . |
4,836 | public function changeFtpPassword ( $ domain , $ ftpUserName , $ password ) { return $ this -> send ( 'v-change-web-domain-ftp-password' , $ this -> userName , $ domain , $ ftpUserName , $ password ) ; } | Change ftp password . |
4,837 | public function create ( array $ data ) : Poll { $ poll = new Poll ( $ data [ 'id' ] , $ this ) ; $ poll -> setType ( $ data [ 'type' ] ) -> setTitle ( $ data [ 'title' ] ) -> setState ( $ data [ 'state' ] ) -> setMultiDay ( ( bool ) $ data [ 'multiDay' ] ) -> setByInvitation ( ( bool ) $ data [ 'byInvitation' ] ) -> s... | Creates a new Poll object . |
4,838 | public function injectInfo ( Poll $ poll ) : array { $ info = $ poll -> _getInfo ( ) ; if ( $ info === null ) { $ info = $ this -> client -> _getInfo ( $ poll ) ; $ poll -> _setInfo ( $ info ) ; } return $ info ; } | Injects the information of a given poll . |
4,839 | public function injectDescription ( Poll $ poll ) { $ info = $ this -> injectInfo ( $ poll ) ; $ description = $ this -> decodeHtml ( $ info [ 'descriptionHTML' ] ) ; $ poll -> setDescription ( $ description ) ; } | Injects the description of a given poll . |
4,840 | public function injectOptions ( Poll $ poll ) { $ info = $ this -> injectInfo ( $ poll ) ; $ type = $ poll -> getType ( ) ; $ options = array ( ) ; foreach ( $ info [ 'options' ] as $ i => $ optionText ) { if ( ! empty ( $ optionText [ 'text' ] ) ) { $ options [ ] = new Option ( $ i , null , null , $ optionText [ 'text... | Injects the option of a given poll . |
4,841 | public function injectParticipants ( Poll $ poll ) { $ info = $ this -> injectInfo ( $ poll ) ; $ options = $ poll -> getOptions ( ) ; $ countOptions = count ( $ options ) ; $ participants = [ ] ; foreach ( $ info [ 'participants' ] as $ p ) { $ preferences = [ ] ; for ( $ i = 0 ; $ i < $ countOptions ; $ i ++ ) { $ pr... | Injects the participants . |
4,842 | public function injectLocation ( Poll $ poll ) { $ location = null ; $ info = $ this -> injectInfo ( $ poll ) ; if ( ! empty ( $ info [ 'location' ] ) ) { $ location = new Location ( $ info [ 'location' ] [ 'name' ] ) ; if ( ! empty ( $ info [ 'location' ] [ 'address' ] ) ) { $ location -> setAddress ( $ info [ 'locati... | Injects the location . |
4,843 | protected function decodeHtml ( $ html ) : string { $ text = html_entity_decode ( $ html ) ; $ text = preg_replace ( '#<br\s*/?>#' , LF , $ text ) ; return $ text ; } | Decodes HTML entities . |
4,844 | public function reset ( ) { $ this -> forcedValue = array ( ) ; $ this -> xPowers = array ( ) ; $ this -> xyPowers = array ( ) ; $ this -> index = 0 ; $ this -> weightingInterface = NULL ; $ squares = ( $ this -> numberOfCoefficient - 1 ) * 2 ; for ( $ index = 0 ; $ index <= $ squares ; ++ $ index ) { $ this -> xPowers... | Reset data . |
4,845 | public function getForcedCoefficient ( $ coefficient ) { $ result = null ; if ( isset ( $ this -> forcedValue [ $ coefficient ] ) ) $ result = $ this -> forcedValue [ $ coefficient ] ; return $ result ; } | Get a forced coefficient . |
4,846 | public function RAdjusted ( $ r2 , $ predictors , $ sample_size ) { if ( ( $ sample_size - $ predictors - 1 ) != 0 ) { $ radjusted = 1 - ( ( 1 - $ r2 ) * ( $ sample_size - 1 ) ) / ( $ sample_size - $ predictors - 1 ) ; } else { $ radjusted = 1.0 ; } return $ radjusted ; } | 08 August 2016 Calculate the Adjusted R Squared . |
4,847 | public static function getPDODriver ( ) { if ( ! class_exists ( 'PDO' ) ) { return null ; } foreach ( PDO :: getAvailableDrivers ( ) as $ driver ) { if ( in_array ( $ driver , array ( 'sqlsrv' , 'dblib' ) ) ) { return $ driver ; } } return null ; } | Get supported PDO driver |
4,848 | protected function quote ( $ conn , $ value ) { if ( $ conn instanceof PDO ) { return $ conn -> quote ( $ value ) ; } elseif ( is_resource ( $ conn ) ) { $ value = str_replace ( "'" , "''" , $ value ) ; $ value = str_replace ( "\0" , "[NULL]" , $ value ) ; return "N'$value'" ; } else { user_error ( 'Invalid database co... | Helper function to quote a string value |
4,849 | protected function query ( $ conn , $ sql ) { $ items = array ( ) ; if ( $ conn instanceof PDO ) { $ result = $ conn -> query ( $ sql ) ; if ( $ result ) { foreach ( $ result as $ row ) { $ items [ ] = $ row [ 0 ] ; } } } elseif ( is_resource ( $ conn ) ) { $ result = sqlsrv_query ( $ conn , $ sql ) ; if ( $ result ) {... | Helper function to execute a query |
4,850 | public function createPackage ( ) { if ( ! $ this -> getSocialAction ( ) ) { throw new MissingTrackingParameterException ( 'social action must be set' ) ; } if ( ! $ this -> getSocialNetwork ( ) ) { throw new MissingTrackingParameterException ( 'social network must be set' ) ; } if ( ! $ this -> getSocialTarget ( ) ) {... | Returns the Google Paket for Social Tracking |
4,851 | public function addCustomPayloadData ( $ key , $ value ) { if ( ! is_string ( $ value ) ) { throw new Exception \ InvalidArgumentException ( 'Custom payload data value must be a string' ) ; } $ this -> customPayload [ $ key ] = $ value ; } | Add Custom Tracking Payload Data send to Google |
4,852 | public function crack ( $ ciphertext ) { $ plaintexts = [ ] ; foreach ( range ( 0 , 25 ) as $ key ) { $ plaintexts [ $ key ] = substr_count ( strtolower ( $ this -> decrypt ( $ ciphertext , $ key ) ) , 'e' ) ; } return array_search ( max ( $ plaintexts ) , $ plaintexts ) ; } | Attempts to brute force the key . This is using an extremely simplified version of frequency analysis . We are just looking for the most frequently used character and assuming it is the letter e . |
4,853 | protected function run ( $ string , $ key ) { return implode ( '' , array_map ( function ( $ char ) use ( $ key ) { return $ this -> shift ( $ char , $ key ) ; } , str_split ( $ string ) ) ) ; } | Runs the algorithm to encrypt or decrypt the given string . |
4,854 | protected function shift ( $ char , $ shift ) { $ shift = $ shift % 25 ; $ ascii = ord ( $ char ) ; $ shifted = $ ascii + $ shift ; if ( $ ascii >= 65 && $ ascii <= 90 ) { return chr ( $ this -> wrapUppercase ( $ shifted ) ) ; } if ( $ ascii >= 97 && $ ascii <= 122 ) { return chr ( $ this -> wrapLowercase ( $ shifted )... | Handles requests to shift a character by the given number of places . |
4,855 | public function initializeAction ( ) { ksort ( $ this -> settings [ 'queryFields' ] ) ; $ this -> initializeConnection ( $ this -> settings [ 'activeConnection' ] ) ; $ this -> requestArguments = $ this -> request -> getArguments ( ) ; $ this -> requestArguments = ArrayUtility :: cleanArgumentsArray ( $ this -> request... | Initialisation and setup . |
4,856 | public function indexAction ( ) { if ( array_key_exists ( 'id' , $ this -> requestArguments ) ) { $ this -> forward ( 'detail' ) ; } else { $ this -> searchProvider -> setCounter ( ) ; $ this -> response -> addAdditionalHeaderData ( FrontendUtility :: addQueryInformationAsJavaScript ( $ this -> searchProvider -> getReq... | Index Action . |
4,857 | protected function addStandardAssignments ( ) { $ this -> searchProvider -> setConfigurationValue ( 'extendedSearch' , $ this -> searchProvider -> isExtendedSearch ( ) ) ; $ this -> searchProvider -> setConfigurationValue ( 'uid' , $ this -> configurationManager -> getContentObject ( ) -> data [ 'uid' ] ) ; $ this -> s... | Assigns standard variables to the view . |
4,858 | public function createPackage ( ) { return array ( 't' => 'timing' , 'utc' => $ this -> getTimingCategory ( ) , 'utv' => $ this -> getTimingVariable ( ) , 'utt' => $ this -> getTimingTime ( ) , 'utl' => $ this -> getTimingLabel ( ) , 'dns' => $ this -> getBrowserDnsLoadTime ( ) , 'pdt' => $ this -> getBrowserPageDownlo... | Returns the Paket for User Timing Tracking |
4,859 | public function createPackage ( ) { if ( ! $ this -> getTransactionID ( ) ) { throw new MissingTrackingParameterException ( 'transaction id is missing' ) ; } if ( ! $ this -> getName ( ) ) { throw new MissingTrackingParameterException ( 'item name is missing' ) ; } return array ( 't' => 'item' , 'ti' => $ this -> getTr... | Create the Package |
4,860 | private function handleResponse ( ApiClient $ apiClient , HttpRequest $ request , $ curl , $ response , $ url ) { $ httpHeaderSize = curl_getinfo ( $ curl , CURLINFO_HEADER_SIZE ) ; $ httpHeader = substr ( $ response , 0 , $ httpHeaderSize ) ; $ httpBody = substr ( $ response , $ httpHeaderSize ) ; $ responseInfo = cur... | Puts together the HTTP response . |
4,861 | protected static function highlightField ( $ fieldContent , $ arguments ) { $ highlightInfo = self :: getHighlightInfo ( $ arguments ) ; if ( is_array ( $ fieldContent ) ) { $ result = [ ] ; foreach ( $ fieldContent as $ singleField ) { $ result [ ] = self :: highlightSingleField ( $ singleField , $ highlightInfo , $ a... | Returns string or array of strings with highlighted areas enclosed by \ ueeee and \ ueeef . |
4,862 | protected static function getHighlightInfo ( $ arguments ) { $ highlightInfo = [ ] ; $ documentID = $ arguments [ 'document' ] [ $ arguments [ 'idKey' ] ] ; if ( $ documentID ) { $ highlighting = $ arguments [ 'results' ] -> getHighlighting ( ) ; if ( $ highlighting ) { if ( $ arguments [ 'alternateField' ] ) { $ highl... | Returns highlight information for the document and field configured in our arguments . |
4,863 | private function createConnection ( $ endpoint ) { $ port = $ this -> getOption ( 'ssl' ) == true ? 443 : 80 ; if ( ! ( $ connection = socket_create ( AF_INET , SOCK_STREAM , SOL_TCP ) ) ) { $ errorcode = socket_last_error ( ) ; $ errormsg = socket_strerror ( $ errorcode ) ; throw new Exception \ EndpointServerExceptio... | Create Connection to the Google Server |
4,864 | private function writeHeader ( $ endpoint , Request \ TrackingRequest $ request , $ lastData = false ) { $ payloadString = http_build_query ( $ request -> getPayload ( ) ) ; $ payloadLength = strlen ( $ payloadString ) ; $ header = 'POST ' . $ endpoint [ 'path' ] . ' HTTP/1.1' . "\r\n" . 'Host: ' . $ endpoint [ 'host' ... | Write the connection header |
4,865 | private function readConnection ( Request \ TrackingRequest $ request ) { $ response = '' ; do { $ out = @ socket_read ( $ this -> connection , self :: READ_BUFFER ) ; $ response .= $ out ; if ( ! $ out || strlen ( $ out ) < self :: READ_BUFFER ) { break ; } } while ( true ) ; $ responseContainer = explode ( "\r\n\r\n"... | Read from the current connection |
4,866 | public function send ( $ url , Request \ TrackingRequestCollection $ requestCollection ) { $ endpoint = parse_url ( $ url ) ; $ this -> createConnection ( $ endpoint ) ; while ( $ requestCollection -> valid ( ) ) { $ request = $ requestCollection -> current ( ) ; $ requestCollection -> next ( ) ; $ this -> writeHeader ... | Send the Request Collection to a Server |
4,867 | public function setMetaData ( $ metaData ) { if ( is_array ( $ metaData ) && empty ( $ metaData ) ) { $ this -> metaData = new \ stdClass ; } else { $ this -> metaData = $ metaData ; } return $ this ; } | Sets metaData . |
4,868 | public function setAttributes ( $ attributes ) { if ( is_array ( $ attributes ) && empty ( $ attributes ) ) { $ this -> attributes = new \ stdClass ; } else { $ this -> attributes = $ attributes ; } return $ this ; } | Sets attributes . |
4,869 | protected function getActiveFacets ( $ arguments ) { $ activeFacets = [ ] ; foreach ( $ this -> settings [ 'facets' ] as $ facet ) { if ( ! empty ( $ facet [ 'selectedByDefault' ] ) ) { $ this -> setActiveFacetSelectionForID ( $ activeFacets , $ facet [ 'id' ] , $ facet [ 'selectedByDefault' ] ) ; } } if ( array_key_ex... | Returns array with information about active facets . |
4,870 | protected function getOffset ( $ arguments = null ) { if ( null === $ arguments ) { $ arguments = $ this -> requestArguments ; } $ offset = 0 ; if ( array_key_exists ( 'start' , $ arguments ) ) { $ offset = ( int ) $ arguments [ 'start' ] ; } else { if ( array_key_exists ( 'page' , $ arguments ) ) { $ offset = ( ( int ... | Returns the index of the first row to return . |
4,871 | public function isExtendedSearch ( ) { $ result = false ; if ( array_key_exists ( 'extended' , $ this -> requestArguments ) ) { $ result = ( true == $ this -> requestArguments [ 'extended' ] ) ; } else { if ( array_key_exists ( 'q' , $ this -> requestArguments ) ) { foreach ( $ this -> settings [ 'queryFields' ] as $ f... | Returns whether extended search should be used or not . |
4,872 | public function getDefaultQuery ( ) { $ this -> createQueryForArguments ( $ this -> getRequestArguments ( ) ) ; $ error = null ; $ resultSet = null ; try { $ resultSet = $ this -> connection -> execute ( $ this -> query ) ; } catch ( HttpException $ exception ) { $ this -> logger -> error ( 'Solr Exception (Timeout?)' ... | Main starting point for blank index action . |
4,873 | protected function setFields ( $ arguments ) { $ fieldsConfig = SettingsUtility :: getMergedSettings ( 'dataFields' , $ this -> settings , $ this -> getAction ( ) ) ; $ fields = [ ] ; if ( array_key_exists ( 'data-fields' , $ arguments ) && $ arguments [ 'data-fields' ] ) { $ fields = explode ( ',' , $ arguments [ 'dat... | Sets up the fields to be fetched by the query . |
4,874 | protected function createQuery ( ) { $ this -> query = $ this -> connection -> createSelect ( ) ; $ this -> addFeatures ( ) ; $ this -> addTypoScriptFilters ( ) ; $ this -> setConfigurationValue ( 'solarium' , $ this -> query ) ; } | Creates a blank query sets up TypoScript filters and adds it to the view . |
4,875 | private function getClientInternal ( $ type = null ) { if ( $ type != null ) { if ( isset ( $ this -> clients [ $ type ] ) ) { return $ this -> clients [ $ type ] ; } else { throw new \ Exception ( "No http client with type '$type' found." ) ; } } else { foreach ( $ this -> clients as $ client ) { if ( $ client -> isSu... | Returns an HTTP client instance . |
4,876 | public function setLabel ( $ label ) { if ( is_array ( $ label ) && empty ( $ label ) ) { $ this -> label = new \ stdClass ; } else { $ this -> label = $ label ; } return $ this ; } | Sets label . |
4,877 | public function getHeaders ( ) { $ headers = array ( ) ; foreach ( $ this -> headers as $ name => $ values ) { foreach ( $ values as $ value ) { $ headers [ ] = strtolower ( $ name ) . ': ' . $ value ; } } $ headers [ ] = self :: HEADER_KEY_CONTENT_LENGTH . ': ' . strlen ( $ this -> getBody ( ) ) ; return $ headers ; } | Returns a list of strings which represent the HTTP headers . |
4,878 | public function addHeader ( $ key , $ value ) { if ( is_array ( $ value ) ) { foreach ( $ value as $ v ) { $ this -> addHeader ( $ key , $ v ) ; } } else { $ this -> headers [ $ key ] [ ] = $ value ; } return $ this ; } | Adds an HTTP header to the request . |
4,879 | public function setUserAgent ( $ userAgent ) { $ this -> userAgent = $ userAgent ; $ this -> removeHeader ( self :: HEADER_KEY_USER_AGENT ) ; $ this -> addHeader ( self :: HEADER_KEY_USER_AGENT , $ userAgent ) ; return $ this ; } | Sets the user agent header . |
4,880 | public function getBody ( ) { if ( $ this -> body && isset ( $ this -> headers [ self :: HEADER_KEY_CONTENT_TYPE ] ) && $ this -> headers [ self :: HEADER_KEY_CONTENT_TYPE ] == 'application/x-www-form-urlencoded' ) { return http_build_query ( $ this -> body ) ; } elseif ( ( is_object ( $ this -> body ) || is_array ( $ ... | Returns the HTTP body . |
4,881 | public function toString ( ) { $ output = $ this -> getStatusLine ( ) . "\r\n" ; foreach ( $ this -> getHeaders ( ) as $ header ) { $ output .= $ header . "\r\n" ; } $ output .= "\r\n" ; $ output .= $ this -> getBody ( ) ; return $ output ; } | Returns the message as a string . |
4,882 | private function getRequestPath ( $ url ) { $ urlParts = parse_url ( $ url ) ; $ path = $ urlParts [ 'path' ] ; if ( isset ( $ urlParts [ 'query' ] ) ) { $ path .= '?' . $ urlParts [ 'query' ] ; } if ( isset ( $ urlParts [ 'fragment' ] ) ) { $ path .= '#' . $ urlParts [ 'fragment' ] ; } return $ path ; } | Returns the request path part of the given url including query and fragment . |
4,883 | private function parseHttpHeaders ( $ rawHeaders ) { $ headers = array ( ) ; $ key = '' ; foreach ( explode ( "\n" , $ rawHeaders ) as $ h ) { $ h = explode ( ':' , $ h , 2 ) ; if ( isset ( $ h [ 1 ] ) ) { if ( ! isset ( $ headers [ $ h [ 0 ] ] ) ) { $ headers [ $ h [ 0 ] ] = trim ( $ h [ 1 ] ) ; } elseif ( is_array ( ... | Returns an array of HTTP response headers . |
4,884 | private function parseRawMessage ( $ message ) { $ positionStartBody = strpos ( $ message , "\r\n\r\n" ) ; $ startPositionOffset = 4 ; if ( $ positionStartBody === false ) { $ positionStartBody = strpos ( $ message , "\n\n" ) ; $ startPositionOffset = 2 ; if ( $ positionStartBody === false ) { throw new \ Exception ( "... | Parses the given HTTP message . |
4,885 | private function parseStatusLine ( $ line ) { if ( empty ( $ line ) ) { throw new \ Exception ( "Empty status line provided." ) ; } preg_match ( '/HTTP\/([^[:space:]])+[[:space:]]+([0-9]*)(.*)/i' , $ line , $ result ) ; $ this -> statusCode = ( int ) $ result [ 2 ] ; } | Parses the given status line . |
4,886 | private function getUri ( $ path , $ params ) { $ uri = '/' ; if ( strlen ( $ path ) > 0 ) { $ uri = $ path ; } if ( strlen ( $ params ) > 0 ) { $ uri .= '?' . $ params ; } return $ uri ; } | Construct the URI if path and params are being passed |
4,887 | public function createPackage ( ) { if ( ! $ this -> getID ( ) ) { throw new MissingTrackingParameterException ( 'transaction id is missing' ) ; } return array ( 't' => 'transaction' , 'ti' => $ this -> getID ( ) , 'ta' => $ this -> getAffiliation ( ) , 'tr' => $ this -> getRevenue ( ) , 'ts' => $ this -> getShipping (... | Returns the Google Paket for Transaction Tracking |
4,888 | public static function sanitizeForSerialization ( $ data ) { if ( is_scalar ( $ data ) || null === $ data ) { return $ data ; } elseif ( $ data instanceof \ DateTime ) { return $ data -> format ( \ DateTime :: ATOM ) ; } elseif ( is_array ( $ data ) ) { foreach ( $ data as $ property => $ value ) { $ data [ $ property ... | Prepare data for serialization . |
4,889 | public function createPackage ( ) { if ( ! $ this -> getEventCategory ( ) ) { throw new MissingTrackingParameterException ( 'event category must be set' ) ; } if ( ! $ this -> getEventAction ( ) ) { throw new MissingTrackingParameterException ( 'event action must be set' ) ; } return array ( 't' => 'event' , 'ec' => $ ... | Returns the Paket for Event Tracking |
4,890 | public static function exceptionToArray ( $ exception , $ includePrevious = false ) { $ array = [ 'message' => $ exception -> getMessage ( ) , 'code' => $ exception -> getCode ( ) , 'file' => $ exception -> getFile ( ) , 'line' => $ exception -> getLine ( ) , 'trace' => $ exception -> getTraceAsString ( ) , ] ; if ( $ ... | Returns an array that can be handled by devLog with the information from an exception . |
4,891 | public function setCompanyName ( $ companyName ) { if ( is_array ( $ companyName ) && empty ( $ companyName ) ) { $ this -> companyName = new \ stdClass ; } else { $ this -> companyName = $ companyName ; } return $ this ; } | Sets companyName . |
4,892 | public function setHeadquartersLocation ( $ headquartersLocation ) { if ( is_array ( $ headquartersLocation ) && empty ( $ headquartersLocation ) ) { $ this -> headquartersLocation = new \ stdClass ; } else { $ this -> headquartersLocation = $ headquartersLocation ; } return $ this ; } | Sets headquartersLocation . |
4,893 | public function setProductName ( $ productName ) { if ( is_array ( $ productName ) && empty ( $ productName ) ) { $ this -> productName = new \ stdClass ; } else { $ this -> productName = $ productName ; } return $ this ; } | Sets productName . |
4,894 | public function add ( $ input , $ attribute = null ) { $ this -> input = $ input ; static :: $ rules [ $ input ] = [ ] ; if ( isset ( $ attribute ) ) { static :: $ attributes [ $ input ] = $ attribute ; } return $ this ; } | Starts the rule builder with an input target |
4,895 | public function message ( $ message ) { if ( isset ( $ this -> currentRule ) ) { static :: $ messages [ $ this -> input . '.' . $ this -> currentRule ] = $ message ; } return $ this ; } | Adds a message for the current rule |
4,896 | public function exists ( $ table , $ column = null ) { $ rule = $ table ; $ args = array_slice ( func_get_args ( ) , 2 ) ; if ( isset ( $ column ) ) { $ rule .= ",$column" ; } if ( $ args ) { foreach ( $ args as $ arg ) { $ rule .= ",$arg" ; } } $ this -> addRule ( "exists:$rule" ) ; return $ this ; } | The field under validation must exist on a given database table |
4,897 | public function unique ( $ table , $ column = null , $ id = false ) { $ rule = $ table ; $ args = array_slice ( func_get_args ( ) , 3 ) ; if ( isset ( $ column ) ) { $ rule .= ",$column" ; } if ( $ id !== false ) { if ( $ id === null ) { $ rule .= ',NULL' ; } else { $ rule .= ",$id" ; } } if ( $ args ) { foreach ( $ ar... | The field under validation must be unique on a given database table . If the column option is not specified the field name will be used |
4,898 | public function getContainer ( $ service = null ) { return is_null ( $ service ) ? ( $ this -> container ? : app ( ) ) : ( $ this -> container [ $ service ] ? : app ( $ service ) ) ; } | Get the IoC container instance or any of it s services . |
4,899 | protected function element ( array $ Element ) { $ markup = '' ; if ( str_is ( 'h[1-6]' , $ Element [ 'name' ] ) ) { $ link = str_replace ( ' ' , '-' , strtolower ( $ Element [ 'text' ] ) ) ; $ markup = '<a class="header-link" href="#' . $ link . '" id="' . $ link . '"><i class="glyphicon glyphicon-link"></i></a>' ; }... | Handlers for all elements . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.