idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
42,900 | public function sendRequest ( OAuthRequest $ request ) { switch ( $ request -> getMethod ( ) ) { case OAuthRequest :: METHOD_GET : $ httpResponse = $ this -> httpAdapter -> getContent ( $ request -> getUrl ( ) , $ request -> getHeaders ( ) ) ; break ; case OAuthRequest :: METHOD_POST : $ postParameters = array ( ) ; fo... | Sends an OAuth request . |
42,901 | private function createRequest ( $ path , $ responseFormat = OAuthResponse :: FORMAT_JSON ) { $ request = new OAuthRequest ( ) ; $ request -> setBaseUrl ( $ this -> getUrl ( ) ) ; $ request -> setPath ( $ path ) ; $ request -> setMethod ( OAuthRequest :: METHOD_POST ) ; $ request -> setResponseFormat ( $ responseFormat... | Creates an OAuth request . |
42,902 | private function createOAuthToken ( OAuthResponse $ response ) { if ( ! $ response -> hasData ( 'oauth_token' ) || ! $ response -> hasData ( 'oauth_token_secret' ) ) { throw new OAuthException ( 'An error occured when creating the OAuth token.' , $ response ) ; } return new OAuthToken ( $ response -> getData ( 'oauth_t... | Creates an oauth token according to an OAuth response . |
42,903 | private function createBearerToken ( OAuthResponse $ response ) { if ( ! $ response -> hasData ( 'token_type' ) || ! $ response -> hasData ( 'access_token' ) ) { throw new OAuthException ( 'An error occured when creating the bearer token.' , $ response ) ; } return new BearerToken ( $ response -> getData ( 'access_toke... | Creates a bearer token according to an OAuth response . |
42,904 | public function resend ( $ log_id ) { $ endpoint = "resend" ; $ payload = array ( "log_id" => $ log_id ) ; return $ this -> api_request ( $ endpoint , self :: HTTP_POST , $ payload ) ; } | Resend a specific email by id |
42,905 | public function get_template ( $ template_id , $ version_id = null ) { $ endpoint = "templates/" . $ template_id ; if ( $ version_id ) { $ endpoint .= "/versions/" . $ version_id ; } return $ this -> api_request ( $ endpoint , self :: HTTP_GET ) ; } | Get a specific template |
42,906 | public function create_email ( $ name , $ subject , $ html , $ text = null ) { $ endpoint = "templates" ; $ payload = array ( "name" => $ name , "subject" => $ subject , "html" => $ html ) ; if ( $ text ) { $ payload [ "text" ] = $ text ; } if ( $ this -> DEBUG ) { $ this -> log_message ( sprintf ( "creating email with... | Create an Email |
42,907 | public function update_template_version ( $ name , $ subject , $ template_id , $ version_id , $ html , $ text = null ) { $ endpoint = "templates/" . $ template_id . "/versions/" . $ version_id ; $ payload = array ( "name" => $ name , "subject" => $ subject , "html" => $ html ) ; if ( $ text ) { $ payload [ "text" ] = $... | Update template version |
42,908 | public function drip_unsubscribe ( $ email_address ) { $ endpoint = "drips/unsubscribe" ; $ payload = array ( "email_address" => $ email_address ) ; return $ this -> api_request ( $ endpoint , self :: HTTP_POST , $ payload ) ; } | Unsubscribe email address from active drips |
42,909 | public function start_on_drip_campaign ( $ recipient_address , $ drip_campaign_id , $ data = null , $ args = null ) { $ endpoint = "drip_campaigns/" . $ drip_campaign_id . "/activate" ; $ payload = array ( ) ; if ( is_array ( $ recipient_address ) ) { $ payload [ "recipient" ] = $ recipient_address ; } else if ( is_str... | Start on drip campaign |
42,910 | public function remove_from_drip_campaign ( $ recipient_address , $ drip_campaign_id ) { $ endpoint = "drip_campaigns/" . $ drip_campaign_id . "/deactivate" ; $ payload = array ( "recipient_address" => $ recipient_address ) ; return $ this -> api_request ( $ endpoint , self :: HTTP_POST , $ payload ) ; } | Remove customer from drip campaign |
42,911 | public function remove_from_all_drip_campaigns ( $ recipient_address ) { $ endpoint = "drip_campaigns/deactivate" ; $ payload = array ( "recipient_address" => $ recipient_address ) ; return $ this -> api_request ( $ endpoint , self :: HTTP_POST , $ payload ) ; } | Remove customer from all drip campaigns |
42,912 | public function start_batch ( ) { return new BatchAPI ( $ this -> API_KEY , array ( 'API_HOST' => $ this -> API_HOST , 'API_PROTO' => $ this -> API_PROTO , 'API_PORT' => $ this -> API_PORT , 'API_VERSION' => $ this -> API_VERSION , 'DEBUG' => $ this -> DEBUG , ) ) ; } | Start Batch API transaction |
42,913 | public function render ( $ email_id , $ args = null ) { $ endpoint = "render" ; $ payload = array ( "template_id" => $ email_id ) ; if ( is_array ( $ args ) ) { $ payload = array_merge ( $ args , $ payload ) ; } if ( $ this -> DEBUG ) { $ this -> log_message ( sprintf ( "rendering template `%s` with \n%s" , $ email_id ... | Render an email template with the provided data |
42,914 | protected function encode_attachment ( $ path ) { if ( ! is_string ( $ path ) ) { $ e = sprintf ( "inline parameter must be path to file as string, received: %s" , gettype ( $ path ) ) ; throw new API_Error ( $ e ) ; } $ file_data = file_get_contents ( $ path ) ; return base64_encode ( $ file_data ) ; } | Helper function to Base64 encode files and return the encoded data |
42,915 | protected function log_message ( $ message , $ priority_level = self :: LOG_DEBUG ) { if ( $ this -> DEBUG && $ this -> API_DEBUG_HANDLER && is_callable ( $ this -> API_DEBUG_HANDLER ) ) { $ response = call_user_func ( $ this -> API_DEBUG_HANDLER , $ message , $ priority_level ) ; } else { $ response = error_log ( $ me... | Log debug messages using the custom handler passed as an option in the constructor . If not handler is defined it falls back to using error_log . |
42,916 | public function execute ( ) { $ endpoint = "batch" ; $ path = $ this -> build_path ( $ endpoint ) ; $ ch = curl_init ( $ path ) ; curl_setopt ( $ ch , CURLOPT_CUSTOMREQUEST , self :: HTTP_POST ) ; $ payload_string = json_encode ( $ this -> commands ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , $ payload_string ) ; $ ht... | Execute all currently queued commands |
42,917 | public function hasData ( $ name = null ) { if ( $ name !== null ) { return is_array ( $ this -> data ) && isset ( $ this -> data [ $ name ] ) ; } return ! empty ( $ this -> data ) ; } | Checks if there is data or a specific data . |
42,918 | public function getHeader ( $ name ) { if ( ! $ this -> hasHeader ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The request header "%s" does not exist.' , $ name ) ) ; } return $ this -> headers [ $ name ] ; } | Gets a specific request header . |
42,919 | public function removeHeader ( $ name ) { if ( ! $ this -> hasHeader ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The request header "%s" does not exist.' , $ name ) ) ; } unset ( $ this -> headers [ $ name ] ) ; } | Removes a request header . |
42,920 | public function getOAuthParameters ( ) { if ( ! $ this -> hasOAuthParameter ( 'oauth_nonce' ) ) { $ this -> setOAuthParameter ( 'oauth_nonce' , md5 ( uniqid ( 'widop' , true ) ) ) ; } if ( ! $ this -> hasOAuthParameter ( 'oauth_timestamp' ) ) { $ this -> setOAuthParameter ( 'oauth_timestamp' , time ( ) ) ; } return $ t... | Gets the request OAuth parameters . |
42,921 | public function setOAuthParameters ( array $ oauthParameters ) { foreach ( $ oauthParameters as $ name => $ value ) { $ this -> setOAuthParameter ( $ name , $ value ) ; } } | Sets the request OAuth parameters . |
42,922 | public function getOAuthParameter ( $ name ) { if ( ! $ this -> hasOAuthParameter ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The OAuth request parameter "%s" does not exist.' , $ name ) ) ; } return $ this -> oauthParameters [ rawurlencode ( $ name ) ] ; } | Gets a specific request OAuth parameter . |
42,923 | public function removeOAuthParameter ( $ name ) { if ( ! $ this -> hasOAuthParameter ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The OAuth request parameter "%s" does not exist.' , $ name ) ) ; } unset ( $ this -> oauthParameters [ rawurlencode ( $ name ) ] ) ; } | Removes a request OAuth parameter . |
42,924 | public function setPathParameters ( array $ pathParameters ) { foreach ( $ pathParameters as $ name => $ value ) { $ this -> setPathParameter ( $ name , $ value ) ; } } | Sets the request path parameters . |
42,925 | public function getPathParameter ( $ name ) { if ( ! $ this -> hasPathParameter ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The path request parameter "%s" does not exist.' , $ name ) ) ; } return $ this -> pathParameters [ $ name ] ; } | Gets a specific request path parameter . |
42,926 | public function removePathParameter ( $ name ) { if ( ! $ this -> hasPathParameter ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The path request parameter "%s" does not exist.' , $ name ) ) ; } unset ( $ this -> pathParameters [ $ name ] ) ; } | Removes a specific request path parameter . |
42,927 | public function setGetParameters ( $ getParameters ) { foreach ( $ getParameters as $ name => $ value ) { $ this -> setGetParameter ( $ name , $ value ) ; } } | Sets the GET request parameters . |
42,928 | public function getGetParameter ( $ name ) { if ( ! $ this -> hasGetParameter ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The GET request parameter "%s" does not exist.' , $ name ) ) ; } return $ this -> getParameters [ rawurlencode ( $ name ) ] ; } | Gets a specific GET request parameter . |
42,929 | public function removeGetParameter ( $ name ) { if ( ! $ this -> hasGetParameter ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The GET request parameter "%s" does not exist.' , $ name ) ) ; } unset ( $ this -> getParameters [ rawurlencode ( $ name ) ] ) ; } | Removes a request GET parameter . |
42,930 | public function setPostParameters ( array $ postParameters ) { foreach ( $ postParameters as $ name => $ value ) { $ this -> setPostParameter ( $ name , $ value ) ; } } | Sets the POST request parameters . |
42,931 | public function getPostParameter ( $ name ) { if ( ! $ this -> hasPostParameter ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The POST request parameter "%s" does not exist.' , $ name ) ) ; } return $ this -> postParameters [ rawurlencode ( $ name ) ] ; } | Gets a request POST parameter . |
42,932 | public function removePostParameter ( $ name ) { if ( ! $ this -> hasPostParameter ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The POST request parameter "%s" does not exist.' , $ name ) ) ; } unset ( $ this -> postParameters [ rawurlencode ( $ name ) ] ) ; } | Removes a request POST parameter . |
42,933 | public function setFileParameters ( array $ fileParameters ) { foreach ( $ fileParameters as $ name => $ value ) { $ this -> setFileParameter ( $ name , $ value ) ; } } | Sets the file request parameters . |
42,934 | public function getFileParameter ( $ name ) { if ( ! $ this -> hasFileParameter ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The file request parameter "%s" does not exist.' , $ name ) ) ; } return $ this -> fileParameters [ $ name ] ; } | Gets a request file parameter . |
42,935 | public function removeFileParameter ( $ name ) { if ( ! $ this -> hasFileParameter ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The file request parameter "%s" does not exist.' , $ name ) ) ; } unset ( $ this -> fileParameters [ $ name ] ) ; } | Removes a request file parameter . |
42,936 | public function getSignature ( ) { if ( $ this -> hasFileParameters ( ) ) { $ elements = $ this -> getOAuthParameters ( ) ; } else { $ elements = array_merge ( $ this -> getOAuthParameters ( ) , $ this -> getGetParameters ( ) , $ this -> getPostParameters ( ) ) ; } ksort ( $ elements ) ; $ stringSignature = array ( ) ;... | Gets the request signature . |
42,937 | public static function find ( $ name ) { if ( empty ( $ name ) ) { throw new \ InvalidArgumentException ( 'Cannot lookup country for an empty name' ) ; } if ( strlen ( $ name ) == 2 || strlen ( $ name ) == 3 ) { $ upcase_name = strtoupper ( $ name ) ; $ country_code = new CountryCode ( $ name ) ; $ country_format = $ c... | Returns a Country object based on a given alpha or numeric code . |
42,938 | public function getMappedFields ( ) { $ mapped = array ( ) ; foreach ( $ this -> fields as $ key => $ value ) { if ( array_key_exists ( $ key , $ this -> mappings ) ) { $ map = $ this -> mappings [ $ key ] ; $ mapped [ $ map ] = $ value ; } } return $ mapped ; } | Gets an array with mapped address fields . |
42,939 | public static function remotefsize ( $ url ) { $ sch = parse_url ( $ url , PHP_URL_SCHEME ) ; if ( ! \ in_array ( $ sch , array ( 'http' , 'https' , 'ftp' , 'ftps' ) , true ) ) { return false ; } if ( \ in_array ( $ sch , array ( 'http' , 'https' ) , true ) ) { $ headers = @ get_headers ( $ url , 1 ) ; if ( ! $ headers... | Remote file size function for streams that don t support it |
42,940 | public static function folders ( $ path , $ filter = '.' , $ recurse = false , $ full = false , $ exclude = array ( '.svn' , 'CVS' , '.DS_Store' , '__MACOSX' ) , $ excludeFilter = array ( '^\..*' ) ) { $ path = Path :: clean ( $ path ) ; if ( ! is_dir ( $ path ) ) { throw new \ UnexpectedValueException ( sprintf ( '%1$... | Utility function to read the folders in a folder . |
42,941 | function send ( $ msg , $ type = '' ) { stream_set_timeout ( $ this -> handle , 2 ) ; fwrite ( $ this -> handle , $ msg ) ; if ( $ type == 'array' ) { $ response = array ( ) ; $ line_num = 0 ; while ( ! feof ( $ this -> handle ) ) { if ( ( $ response [ $ line_num ] = fgets ( $ this -> handle , 4096 ) ) === false ) { br... | Send data through the socket and listen for a return |
42,942 | public function authorize ( $ money , CreditCard $ creditcard , $ options = array ( ) ) { $ this -> required_options ( 'address,order_id' , $ options ) ; $ this -> post = array ( ) ; $ this -> addInvoice ( $ options ) ; $ this -> addCreditcard ( $ creditcard ) ; $ this -> addAddress ( $ options ) ; $ this -> addCustome... | Binds the given amount to customer creditcard |
42,943 | public function capture ( $ money , $ authorization , $ options = array ( ) ) { $ this -> required_options ( "order_id" , $ options ) ; $ this -> post = array ( "AuthTrxnNumber" => $ authorization , "TotalAmount" => $ this -> amount ( $ money ) ) ; $ cc = new CreditCard ( array ( ) ) ; $ this -> addCreditcard ( $ cc ) ... | Captures the given amount which was previously authorized |
42,944 | public function fetch ( ) { if ( $ row = mysql_fetch_array ( $ this -> query ) ) { return $ row ; } else if ( $ this -> size ( ) > 0 ) { mysql_data_seek ( $ this -> query , 0 ) ; return false ; } else { return false ; } } | Fetches the next result |
42,945 | public function getFriends ( $ methodVars ) { if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'user.getfriends' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { if ( count ( $ call -> friends -> user ... | Get a list of the user s friends on Last . fm |
42,946 | public function getLovedTracks ( $ methodVars ) { if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'user.getlovedtracks' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { if ( count ( $ call -> lovedtra... | Get the last 50 tracks loved by a user |
42,947 | public function getNeighbours ( $ methodVars ) { if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'user.getneighbours' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( ! empty ( $ methodVars [ 'limit' ] ) ) { $ vars [ 'limit' ] = $ methodVars [ '... | Get a list of a user s neighbours on Last . fm |
42,948 | public function getPlaylists ( $ methodVars ) { if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'user.getplaylists' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { if ( count ( $ call -> playlists ->... | Get a list of a user s playlists on Last . fm |
42,949 | public function getRecentTracks ( $ methodVars ) { if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'user.getrecenttracks' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { if ( count ( $ call -> recent... | Get a list of the recent tracks listened to by this user . Indicates now playing track if the user is currently listening |
42,950 | public function getTopAlbums ( $ methodVars ) { if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'user.gettopalbums' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { if ( count ( $ call -> topalbums ->... | Get the top albums listened to by a user . You can stipulate a time period . Sends the overall chart by default |
42,951 | public function getTopArtists ( $ methodVars ) { if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'user.gettopartists' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { if ( count ( $ call -> topartists... | Get the top artists listened to by a user . You can stipulate a time period . Sends the overall chart by default |
42,952 | public function getTopTracks ( $ methodVars ) { if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'user.gettoptracks' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { if ( count ( $ call -> toptracks ->... | Get the top tracks listened to by a user . You can stipulate a time period . Sends the overall chart by default |
42,953 | public function getWeeklyAlbumChart ( $ methodVars ) { $ weeklyalbums = array ( ) ; if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'user.getweeklyalbumchart' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ var... | Get an album chart for a user profile for a given date range . If no date range is supplied it will return the most recent album chart for this user |
42,954 | public function getWeeklyArtistChart ( $ methodVars ) { $ weeklyartists = array ( ) ; if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'user.getweeklyartistchart' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ ... | Get an artist chart for a user profile for a given date range . If no date range is supplied it will return the most recent artist chart for this user |
42,955 | public function getWeeklyChartList ( $ methodVars ) { if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'user.getweeklychartlist' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { $ i = 0 ; foreach ( $ c... | Get a list of available charts for this user expressed as date ranges which can be sent to the chart services |
42,956 | public function getWeeklyTrackChart ( $ methodVars ) { $ weeklytracks = array ( ) ; if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'user.getweeklytrackchart' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ var... | Get a track chart for a user profile for a given date range . If no date range is supplied it will return the most recent track chart for this user |
42,957 | public static function canChmod ( $ path ) { if ( ! file_exists ( $ path ) ) { return false ; } $ perms = @ fileperms ( $ path ) ; if ( $ perms !== false ) { if ( @ chmod ( $ path , $ perms ^ 0001 ) ) { @ chmod ( $ path , $ perms ) ; return true ; } } return false ; } | Checks if a path s permissions can be changed . |
42,958 | private function addInvoice ( $ money , $ options ) { $ this -> post [ 'amount' ] = $ this -> amount ( $ money / 100 ) ; $ this -> post [ 'currency' ] = self :: $ default_currency ; $ this -> post [ 'description' ] = $ options [ 'description' ] ; } | Adds invoice info if exist . |
42,959 | public function reset ( ) { $ this -> sources = array ( ) ; $ this -> destinations = array ( ) ; $ this -> removals = array ( ) ; $ this -> patches = array ( ) ; return $ this ; } | Reset the pacher |
42,960 | public function addFile ( $ filename , $ root = JPATH_ROOT , $ strip = 0 ) { return $ this -> add ( file_get_contents ( $ filename ) , $ root , $ strip ) ; } | Add a unified diff file to the patcher |
42,961 | protected function & getSource ( $ src ) { if ( ! isset ( $ this -> sources [ $ src ] ) ) { if ( is_readable ( $ src ) ) { $ this -> sources [ $ src ] = self :: splitLines ( file_get_contents ( $ src ) ) ; } else { $ this -> sources [ $ src ] = null ; } } return $ this -> sources [ $ src ] ; } | Get the lines of a source file |
42,962 | protected function & getDestination ( $ dst , $ src ) { if ( ! isset ( $ this -> destinations [ $ dst ] ) ) { $ this -> destinations [ $ dst ] = $ this -> getSource ( $ src ) ; } return $ this -> destinations [ $ dst ] ; } | Get the lines of a destination file |
42,963 | private function connectToDb ( ) { if ( ! $ this -> dbConn = @ mysql_connect ( $ this -> host , $ this -> dbUser , $ this -> dbPass ) ) { $ this -> handleError ( ) ; } else if ( ! @ mysql_select_db ( $ this -> dbName , $ this -> dbConn ) ) { $ this -> handleError ( ) ; } } | Internal command to connect to the database |
42,964 | public function query ( $ sql ) { if ( ! $ queryResource = mysql_query ( $ sql , $ this -> dbConn ) ) { echo mysql_error ( ) ; $ this -> handleError ( ) ; } else { return new MySqlResult ( $ this , $ queryResource ) ; } } | Command which runs queries . Returns a class on success and flase on error |
42,965 | private function check_if_enabled ( ) { if ( $ this -> config [ 'enabled' ] == true && extension_loaded ( 'sqlite3' ) ) { $ this -> enabled = true ; } else { $ this -> enabled = false ; } } | Internal method to chack if caching is enabled |
42,966 | private function check_table_exists ( ) { if ( $ this -> type == 'sqlite' ) { $ query = "SELECT count(*) FROM sqlite_master WHERE name='cache'" ; $ result = $ this -> db -> query ( $ query ) ; $ numbers = $ result -> fetchAll ( ) ; if ( $ numbers [ 0 ] [ 'count(*)' ] > 0 ) { } else { $ this -> create_table ( ) ; } } el... | Internal method to check if the table exists |
42,967 | private function create_table ( ) { if ( $ this -> type == 'sqlite' ) { $ auto_increase = '' ; } else { $ auto_increase = ' AUTO_INCREMENT' ; } $ query = "CREATE TABLE cache (cache_id INTEGER PRIMARY KEY" . $ auto_increase . ", unique_vars TEXT, expires INT, body TEXT)" ; if ( $ this -> db -> query ( $ query ) ) { } el... | Internal method to create the table if it doesn t exist |
42,968 | public function get ( $ unique_vars ) { if ( $ this -> enabled == true ) { $ query = "SELECT expires, body FROM cache WHERE unique_vars='" . htmlentities ( serialize ( $ unique_vars ) , ENT_QUOTES , 'UTF-8' ) . "' LIMIT 1" ; if ( $ result = $ this -> db -> query ( $ query ) ) { if ( $ result -> size ( ) > 0 ) { $ row =... | Searches the database for the cahce date . Returns an array if it exists or false if it doesn t |
42,969 | public function set ( $ unique_vars , $ body ) { if ( $ this -> enabled == true ) { $ expire = time ( ) + $ this -> config [ 'cache_length' ] ; $ query = "INSERT INTO cache (unique_vars, expires, body) VALUES ('" . htmlentities ( serialize ( $ unique_vars ) , ENT_QUOTES , 'UTF-8' ) . "', '" . $ expire . "', \"" . htmle... | Adds new cache data to the database |
42,970 | private function del ( $ unique_vars ) { $ query = "DELETE FROM cache WHERE unique_vars='" . htmlentities ( serialize ( $ unique_vars ) , ENT_QUOTES , 'UTF-8' ) . "'" ; if ( $ this -> db -> query ( $ query ) ) { return true ; } else { return false ; } } | Internal method to delete unneeded cache data |
42,971 | private function packAuthorizationValues ( $ orderid , $ transactionid ) { return implode ( "&" , array ( self :: AUTHSTR_VERSION , urlencode ( $ orderid ) , urlencode ( $ transactionid ) ) ) ; } | Create a string with required transaction data . |
42,972 | public function getGateways ( ) { $ gateways = array ( ) ; foreach ( $ this -> supported_gateways as $ gateway ) { $ class = 'AktiveMerchant\\Billing\\Gateways\\' . $ gateway ; $ gateways [ Inflect :: underscore ( $ gateway ) ] = $ class :: $ display_name ; } return $ gateways ; } | Gets an array with Gateways . |
42,973 | public function getSupportedActions ( $ gateway ) { if ( ! is_string ( $ gateway ) ) { $ gateway = get_class ( $ gateway ) ; } $ gateway = Inflect :: camelize ( $ gateway ) ; $ class = new \ ReflectionClass ( 'AktiveMerchant\\Billing\\Gateways\\' . $ gateway ) ; $ actions = array ( ) ; foreach ( $ this -> actions as $ ... | Gets an array with supported actions for given gateway . |
42,974 | private function addCentinelData ( $ options ) { $ this -> required_options ( 'cavv, eci_flag, xid, enrolled, pares_status, signature_verification' , $ options ) ; $ this -> post [ 'ProcessTransaction' ] [ 'TransactionRequest' ] [ 'Body' ] [ 'TransactionInfo' ] [ 'AuthInfo' ] [ 'Cavv' ] = $ options [ 'cavv' ] ; $ this ... | Add required data from 3D centinel verification |
42,975 | public function authorize ( $ money , CreditCard $ creditcard , $ options = array ( ) ) { $ this -> required_options ( 'order_id' , $ options ) ; $ this -> buildPurchaseOrAuthorizationRequest ( 'authorization' , $ money , $ creditcard , $ options ) ; return $ this -> commit ( ) ; } | Performs an authorization which reserves the funds on the customer s credit card but does not charge the card . |
42,976 | public function capture ( $ money , $ authorization , $ options = array ( ) ) { $ this -> required_options ( 'pasref, order_id' , $ options ) ; $ this -> buildCaptureRequest ( $ authorization , $ options ) ; return $ this -> commit ( ) ; } | Captures the funds from an authorized transaction . |
42,977 | public function credit ( $ money , $ authorization , $ options = array ( ) ) { $ this -> required_options ( 'pasref, order_id' , $ options ) ; $ this -> buildCreditRequest ( $ money , $ authorization , $ options ) ; return $ this -> commit ( ) ; } | Credit an account . |
42,978 | public function void ( $ authorization , $ options = array ( ) ) { $ this -> required_options ( 'pasref, order_id' , $ options ) ; $ this -> buildVoidRequest ( $ authorization , $ options ) ; return $ this -> commit ( ) ; } | Void a previous transaction |
42,979 | public function recurring ( $ money , CreditCard $ creditcard , $ options = array ( ) ) { $ this -> required_options ( 'order_id' , $ options ) ; $ this -> buildReceiptInRequest ( $ money , $ options ) ; return $ this -> commit ( 'recurring' ) ; } | Process a recurring payment transaction |
42,980 | public function store ( CreditCard $ creditcard , $ options = array ( ) ) { $ this -> required_options ( 'order_id' , $ options ) ; $ this -> buildNewCardRequest ( $ creditcard , $ options ) ; return $ this -> commit ( 'recurring' ) ; } | Store new card information in Realex RealVault |
42,981 | public function unstore ( $ reference , $ options = array ( ) ) { $ this -> required_options ( 'order_id' , $ options ) ; $ this -> buildCancelCardRequest ( $ options ) ; return $ this -> commit ( 'recurring' ) ; } | Remove card information from Realex RealVault |
42,982 | public function storeUser ( $ options ) { $ this -> required_options ( 'order_id' , $ options ) ; $ this -> buildNewPayerRequest ( $ options ) ; return $ this -> commit ( 'recurring' ) ; } | Store User information in the Realex RealVault |
42,983 | private function messageFrom ( $ response ) { $ result = ( string ) $ response -> result ; $ response_message = ( string ) $ response -> message ; switch ( $ result ) { case '00' : $ message = $ this -> messages [ 'SUCCESS' ] ; break ; case '101' : case '102' : case '103' : $ message = ( $ this -> inTestMode ( $ respon... | Parse the message from the response |
42,984 | private function paramsFrom ( $ response ) { $ attribs = $ response -> attributes ( ) ; $ params = array ( ) ; $ params [ 'result' ] = ( string ) $ response -> result ; $ params [ 'pasref' ] = ( string ) $ response -> pasref ; $ params [ 'order_id' ] = ( string ) $ response -> orderid ; $ params [ 'batch_id' ] = ( stri... | get the params from the XML response |
42,985 | private function optionsFrom ( $ response ) { $ options = array ( ) ; $ options [ 'test' ] = ( strstr ( ( string ) $ response -> message , '[ test system ]' ) ) ? true : false ; $ options [ 'authorization' ] = ( string ) $ response -> authcode ; $ options [ 'cvv_result' ] = ( string ) $ response -> cvnresult ; $ option... | get the options from the XML response |
42,986 | public function getSimilar ( $ methodVars ) { if ( ! empty ( $ methodVars [ 'tag' ] ) ) { $ vars = array ( 'method' => 'tag.getsimilar' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; $ similar = array ( ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { $ i = 0 ; foreach... | Search for tags similar to this one . Returns tags ranked by similarity based on listening data |
42,987 | public function getTopAlbums ( $ methodVars ) { if ( ! empty ( $ methodVars [ 'tag' ] ) ) { $ vars = array ( 'method' => 'tag.gettopalbums' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { $ i = 0 ; foreach ( $ call -> albums ... | Get the top albums tagged by this tag ordered by tag count |
42,988 | public function getTopArtists ( $ methodVars ) { if ( ! empty ( $ methodVars [ 'tag' ] ) ) { $ vars = array ( 'method' => 'tag.gettopartists' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { $ i = 0 ; foreach ( $ call -> topar... | Get the top artists tagged by this tag ordered by tag count |
42,989 | public function search ( $ methodVars ) { if ( ! empty ( $ methodVars [ 'tag' ] ) ) { $ vars = array ( 'method' => 'tag.search' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { $ opensearch = $ call -> results -> children ( 'h... | Search for a tag by name . Returns matches sorted by relevance |
42,990 | protected function ssl_request ( $ method , $ endpoint , $ data , array $ options = array ( ) ) { $ request = $ this -> request ? : new Request ( $ endpoint , $ method , $ options ) ; $ request -> setMethod ( $ method ) ; $ request -> setUrl ( $ endpoint ) ; $ request -> setBody ( $ data ) ; $ request -> setDispatcher ... | Send a request to a remote server and return the response . |
42,991 | protected function urlize ( $ params ) { $ string = "" ; foreach ( $ params as $ key => $ value ) { $ string .= $ key . '=' . urlencode ( trim ( $ value ) ) . '&' ; } return rtrim ( $ string , "& " ) ; } | Convert an associative array to url parameters |
42,992 | protected function cc_format ( $ number , $ options ) { if ( empty ( $ number ) ) { return '' ; } switch ( $ options ) { case 'two_digits' : $ number = sprintf ( "%02d" , $ number ) ; return substr ( $ number , - 2 ) ; break ; case 'four_digits' : return sprintf ( "%04d" , $ number ) ; break ; default : return $ number... | Formats values from a credit card . |
42,993 | protected function currency_lookup ( $ code ) { $ currency = new CurrencyCode ( ) ; if ( isset ( $ currency [ $ code ] ) ) { return $ currency [ $ code ] ; } return false ; } | Lookup for numeric currency codes and returns numeric represantation of ISO 4217 currency code . |
42,994 | public function addListener ( $ eventName , $ listener , $ priority = 0 ) { $ this -> getDispatcher ( ) -> addListener ( $ eventName , $ listener , $ priority ) ; } | Add a listener to gateway event . |
42,995 | private function parse ( $ body ) { if ( empty ( $ body ) ) { throw new Exception ( 'Error parsing credit card response: Empty response' ) ; } $ fields = explode ( '|' , $ body ) ; if ( count ( $ fields ) < 39 ) { throw new Exception ( 'Error parsing credit card response: Too few fields' ) ; } $ response = array ( 'res... | Parse raw gateway body response . |
42,996 | private function getSession ( ) { $ vars = array ( 'method' => 'auth.getSession' , 'api_key' => $ this -> apiKey , 'token' => $ this -> token ) ; $ sig = $ this -> apiSig ( $ this -> apiSecret , $ vars ) ; $ vars [ 'api_sig' ] = $ sig ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { $ this -> username = ( string ) $... | Internal method uses to get a new session via an api call |
42,997 | private function getToken ( ) { $ vars = array ( 'method' => 'auth.getToken' , 'api_key' => $ this -> apiKey ) ; $ sig = $ this -> apiSig ( $ this -> apiSecret , $ vars ) ; $ vars [ 'api_sig' ] = $ sig ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { $ this -> token = $ call -> token ; } else { return false ; } } | Internal method uses to get a new token via an api call |
42,998 | public function getAlbums ( $ methodVars ) { if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'library.getalbums' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { $ albums [ 'page' ] = ( string ) $ cal... | A paginated list of all the albums in a user s library with play counts and tag counts |
42,999 | public function getArtists ( $ methodVars ) { if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'library.getartists' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { $ artists [ 'page' ] = ( string ) $ ... | A paginated list of all the artists in a user s library with play counts and tag counts |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.