idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
17,900
public function getPicture ( $ group , $ type = null ) { if ( $ type ) { $ type = '?type=' . $ type ; } return $ this -> getConnection ( $ group , 'picture' , $ type ) ; }
Method to get the groups s picture . Requires authentication and user_groups or friends_groups permission .
17,901
public function createLink ( $ group , $ link , $ message = null ) { $ data = array ( ) ; $ data [ 'link' ] = $ link ; if ( $ message ) { $ data [ 'message' ] = $ message ; } return $ this -> createConnection ( $ group , 'feed' , $ data ) ; }
Method to post a link on group s wall . Requires authentication and publish_stream permission .
17,902
public function createPost ( $ group , $ message = null , $ link = null , $ picture = null , $ name = null , $ caption = null , $ description = null , $ actions = null ) { if ( $ message ) { $ data [ 'message' ] = $ message ; } if ( $ link ) { $ data [ 'link' ] = $ link ; } if ( $ name ) { $ data [ 'name' ] = $ name ; ...
Method to post on group s wall . Message or link parameter is required . Requires authentication and publish_stream permission .
17,903
public function createStatus ( $ group , $ message ) { $ data = array ( ) ; $ data [ 'message' ] = $ message ; return $ this -> createConnection ( $ group , 'feed' , $ data ) ; }
Method to post a status message on behalf of the user on the group s wall . Requires authentication and publish_stream permission .
17,904
public function create ( $ gistId , $ body ) { $ path = '/gists/' . ( int ) $ gistId . '/comments' ; $ data = json_encode ( array ( 'body' => $ body , ) ) ; $ response = $ this -> client -> post ( $ this -> fetchUrl ( $ path ) , $ data ) ; if ( $ response -> code != 201 ) { $ error = json_decode ( $ response -> body ) ...
Method to create a comment on a gist .
17,905
public function edit ( $ commentId , $ body ) { $ path = '/gists/comments/' . ( int ) $ commentId ; $ data = json_encode ( array ( 'body' => $ body ) ) ; $ response = $ this -> client -> patch ( $ this -> fetchUrl ( $ path ) , $ data ) ; if ( $ response -> code != 200 ) { $ error = json_decode ( $ response -> body ) ; ...
Method to update a comment on a gist .
17,906
public function verifyCredentials ( ) { $ token = $ this -> getToken ( ) ; $ parameters = array ( 'oauth_token' => $ token [ 'key' ] ) ; $ path = 'https://api.twitter.com/1.1/account/verify_credentials.json' ; $ response = $ this -> oauthRequest ( $ path , 'GET' , $ parameters ) ; if ( $ response -> code == 200 ) { ret...
Method to verify if the access token is valid by making a request .
17,907
public function endSession ( ) { $ token = $ this -> getToken ( ) ; $ parameters = array ( 'oauth_token' => $ token [ 'key' ] ) ; $ path = 'https://api.twitter.com/1.1/account/end_session.json' ; $ response = $ this -> oauthRequest ( $ path , 'POST' , $ parameters ) ; return json_decode ( $ response -> body ) ; }
Ends the session of the authenticating user returning a null cookie .
17,908
public static function getInstance ( $ host = '127.0.0.1' , $ port = '21' , array $ options = array ( ) , $ user = null , $ pass = null ) { $ signature = $ user . ':' . $ pass . '@' . $ host . ":" . $ port ; if ( ! isset ( self :: $ instances [ $ signature ] ) || ! is_object ( self :: $ instances [ $ signature ] ) ) { ...
Returns the global FTP connector object only creating it if it doesn t already exist .
17,909
public function read ( $ remote , & $ buffer ) { $ mode = $ this -> _findMode ( $ remote ) ; if ( FTP_NATIVE ) { if ( @ ftp_pasv ( $ this -> conn , true ) === false ) { Log :: add ( __METHOD__ . ': Unable to use passive mode.' , Log :: WARNING , 'jerror' ) ; return false ; } $ tmp = fopen ( 'buffer://tmp' , 'br+' ) ; i...
Method to read a file from the FTP server s contents into a buffer
17,910
public function updateTag ( $ photo , $ to , $ x = null , $ y = null ) { $ data [ 'to' ] = $ to ; if ( $ x ) { $ data [ 'x' ] = $ x ; } if ( $ y ) { $ data [ 'y' ] = $ y ; } return $ this -> createConnection ( $ photo , 'tags' , $ data ) ; }
Method to update the position of the tag for a particular Users in a photo . Requires authentication and publish_stream permission user_photos permission for private photos .
17,911
private function getFileData ( $ key ) { if ( $ this -> metadata [ $ key ] [ '_method' ] == 0x8 ) { return gzinflate ( substr ( $ this -> data , $ this -> metadata [ $ key ] [ '_dataStart' ] , $ this -> metadata [ $ key ] [ 'csize' ] ) ) ; } elseif ( $ this -> metadata [ $ key ] [ '_method' ] == 0x0 ) { return substr (...
Returns the file data for a file by offsest in the ZIP archive
17,912
public function getList ( $ org ) { $ path = '/orgs/' . $ org . '/members' ; $ response = $ this -> client -> get ( $ this -> fetchUrl ( $ path ) ) ; switch ( $ response -> code ) { case 302 : return false ; break ; case 200 : return json_decode ( $ response -> body ) ; break ; default : throw new \ UnexpectedValueExce...
Members list .
17,913
public function getDirectMessagesById ( $ id ) { $ this -> checkRateLimit ( 'direct_messages' , 'show' ) ; $ path = '/direct_messages/show.json' ; $ data [ 'id' ] = $ id ; return $ this -> sendRequest ( $ path , 'GET' , $ data ) ; }
Method to get a single direct message specified by an id parameter .
17,914
public function createPost ( $ group_id , $ title , $ summary ) { $ token = $ this -> oauth -> getToken ( ) ; $ parameters = array ( 'oauth_token' => $ token [ 'key' ] ) ; $ this -> oauth -> setOption ( 'success_code' , 201 ) ; $ base = '/v1/groups/' . $ group_id . '/posts' ; $ xml = '<post><title>' . $ title . '</titl...
Method to retrieve all comments of a post .
17,915
public function deletePost ( $ post_id ) { $ token = $ this -> oauth -> getToken ( ) ; $ parameters = array ( 'oauth_token' => $ token [ 'key' ] ) ; $ this -> oauth -> setOption ( 'success_code' , 204 ) ; $ base = '/v1/posts/' . $ post_id ; $ path = $ this -> getOption ( 'api.url' ) . $ base ; $ response = $ this -> oa...
Method to delete a post if the current user is the creator or flag it as inappropriate otherwise .
17,916
public function create ( $ owner , $ repo , $ title , $ key ) { $ path = '/repos/' . $ owner . '/' . $ repo . '/keys' ; $ data = array ( 'title' => $ title , 'key' => $ key ) ; return $ this -> processResponse ( $ this -> client -> post ( $ this -> fetchUrl ( $ path ) , json_encode ( $ data ) ) , 201 ) ; }
Create a key .
17,917
public function edit ( $ owner , $ repo , $ id , $ title , $ key ) { $ path = '/repos/' . $ owner . '/' . $ repo . '/keys/' . ( int ) $ id ; $ data = array ( 'title' => $ title , 'key' => $ key ) ; return $ this -> processResponse ( $ this -> client -> patch ( $ this -> fetchUrl ( $ path ) , json_encode ( $ data ) ) ) ...
Edit a key .
17,918
public function getMultiple ( $ keys ) { $ items = array ( ) ; $ success = false ; $ values = apc_fetch ( $ keys , $ success ) ; if ( $ success && is_array ( $ values ) ) { foreach ( $ values as $ key => $ value ) { $ items [ $ key ] = new Item ( $ key ) ; $ items [ $ key ] -> setValue ( $ value ) ; } } return $ items ...
Obtain multiple CacheItems by their unique keys .
17,919
public function getCalendar ( $ calendarID ) { if ( $ this -> isAuthenticated ( ) ) { $ jdata = $ this -> query ( 'https://www.googleapis.com/calendar/v3/users/me/calendarList/' . urlencode ( $ calendarID ) ) ; if ( $ data = json_decode ( $ jdata -> body , true ) ) { return $ data ; } else { throw new UnexpectedValueEx...
Method to get a calendar s settings from Google
17,920
public function addCalendar ( $ calendarID , $ options = array ( ) ) { if ( $ this -> isAuthenticated ( ) ) { $ options [ 'id' ] = $ calendarID ; $ url = 'https://www.googleapis.com/calendar/v3/users/me/calendarList' ; $ jdata = $ this -> query ( $ url , json_encode ( $ options ) , array ( 'Content-type' => 'applicatio...
Method to add a calendar to a user s Google Calendar list
17,921
public function clearCalendar ( $ calendarID ) { if ( $ this -> isAuthenticated ( ) ) { $ data = $ this -> query ( 'https://www.googleapis.com/calendar/v3/users/me/calendars/' . urlencode ( $ calendarID ) . '/clear' , null , null , 'post' ) ; if ( $ data -> body != '' ) { throw new UnexpectedValueException ( "Unexpecte...
Method to clear a Google Calendar
17,922
public function deleteEvent ( $ calendarID , $ eventID ) { if ( $ this -> isAuthenticated ( ) ) { $ url = 'https://www.googleapis.com/calendar/v3/users/me/calendars/' . urlencode ( $ calendarID ) . '/events/' . urlencode ( $ eventID ) ; $ data = $ this -> query ( $ url , null , null , 'delete' ) ; if ( $ data -> body !...
Method to delete an event from a Google Calendar
17,923
public function getEvent ( $ calendarID , $ eventID , $ options = array ( ) ) { if ( $ this -> isAuthenticated ( ) ) { $ url = 'https://www.googleapis.com/calendar/v3/users/me/calendarList/' ; $ url .= urlencode ( $ calendarID ) . '/events/' . urlencode ( $ eventID ) . '?' . http_build_query ( $ options ) ; $ jdata = $...
Method to get an event from a Google Calendar
17,924
public function listRecurrences ( $ calendarID , $ eventID , $ options = array ( ) , $ maxpages = 1 ) { if ( $ this -> isAuthenticated ( ) ) { $ next = array_key_exists ( 'nextPageToken' , $ options ) ? $ options [ 'nextPage' ] : null ; unset ( $ options [ 'nextPageToken' ] ) ; $ url = 'https://www.googleapis.com/calen...
Method to retrieve a list of events on a Google calendar
17,925
public function moveEvent ( $ calendarID , $ eventID , $ destID , $ notify = false ) { if ( $ this -> isAuthenticated ( ) ) { $ url = 'https://www.googleapis.com/calendar/v3/calendars/' . urlencode ( $ calendarID ) . '/events/' . urlencode ( $ eventID ) . '/move' ; $ url .= '?destination=' . $ destID . ( $ notify ? '&s...
Method to move an event from one calendar to another
17,926
public function getTrends ( $ id , $ exclude = null ) { $ this -> checkRateLimit ( 'trends' , 'place' ) ; $ path = '/trends/place.json' ; $ data [ 'id' ] = $ id ; if ( $ exclude ) { $ data [ 'exclude' ] = $ exclude ; } return $ this -> sendRequest ( $ path , 'GET' , $ data ) ; }
Method to get the top 10 trending topics for a specific WOEID if trending information is available for it .
17,927
public function getClosest ( $ lat = null , $ long = null ) { $ this -> checkRateLimit ( 'trends' , 'closest' ) ; $ path = '/trends/closest.json' ; $ data = array ( ) ; if ( $ lat ) { $ data [ 'lat' ] = $ lat ; } if ( $ long ) { $ data [ 'long' ] = $ long ; } return $ this -> sendRequest ( $ path , 'GET' , $ data ) ; }
Method to get the locations that Twitter has trending topic information for closest to a specified location .
17,928
public function isMember ( $ id , $ user ) { $ path = '/teams/' . $ id . '/members/' . $ user ; $ response = $ this -> client -> get ( $ this -> fetchUrl ( $ path ) ) ; switch ( $ response -> code ) { case 204 : return true ; break ; case 404 : return false ; break ; default : throw new \ UnexpectedValueException ( 'Un...
Get team member .
17,929
public function addMember ( $ id , $ user ) { $ path = '/teams/' . $ id . '/members/' . $ user ; return $ this -> processResponse ( $ this -> client -> put ( $ this -> fetchUrl ( $ path ) , '' ) , 204 ) ; }
Add team member .
17,930
public function addRepo ( $ id , $ org , $ repo ) { $ path = '/teams/' . $ id . '/repos/' . $ org . '/' . $ repo ; return $ this -> processResponse ( $ this -> client -> put ( $ this -> fetchUrl ( $ path ) , '' ) , 204 ) ; }
Add team repo .
17,931
protected function getId ( $ fieldId , $ fieldName ) { $ id = '' ; if ( $ this -> formControl ) { $ id .= $ this -> formControl ; } if ( $ this -> group ) { if ( $ id ) { $ id .= '_' . str_replace ( '.' , '_' , $ this -> group ) ; } else { $ id .= str_replace ( '.' , '_' , $ this -> group ) ; } } if ( $ id ) { $ id .= ...
Method to get the id used for the field input tag .
17,932
protected function getName ( $ fieldName ) { $ name = '' ; if ( $ this -> formControl ) { $ name .= $ this -> formControl ; } if ( $ this -> group ) { $ groups = explode ( '.' , $ this -> group ) ; if ( $ name ) { foreach ( $ groups as $ group ) { $ name .= '[' . $ group . ']' ; } } else { $ name .= array_shift ( $ gro...
Method to get the name used for the field input tag .
17,933
protected function getFieldName ( $ fieldName ) { if ( $ fieldName ) { return $ fieldName ; } else { self :: $ count = self :: $ count + 1 ; return self :: $ generated_fieldname . self :: $ count ; } }
Method to get the field name used .
17,934
public function updateProfile ( $ name = null , $ url = null , $ location = null , $ description = null , $ entities = null , $ skip_status = null ) { $ this -> checkRateLimit ( 'account' , 'update_profile' ) ; $ data = array ( ) ; if ( $ name ) { $ data [ 'name' ] = $ name ; } if ( $ url ) { $ data [ 'url' ] = $ url ;...
Method to et values that users are able to set under the Account tab of their settings page .
17,935
public function deleteMarker ( $ index = null ) { $ markers = $ this -> listMarkers ( ) ; if ( $ index === null ) { $ index = count ( $ markers ) - 1 ; } if ( $ index >= count ( $ markers ) || $ index < 0 ) { throw new OutOfBoundsException ( 'Marker index out of bounds.' ) ; } $ marker = $ markers [ $ index ] ; unset (...
Delete a marker from the map
17,936
public function getHeader ( ) { if ( ! $ this -> getOption ( 'key' ) ) { throw new UnexpectedValueException ( 'A Google Maps API key is required.' ) ; } $ zoom = $ this -> getZoom ( ) ; $ center = $ this -> getCenter ( ) ; $ maptype = $ this -> getMapType ( ) ; $ id = $ this -> getMapID ( ) ; $ scheme = $ this -> isSec...
Get code to load Google Maps javascript
17,937
public function getBody ( ) { $ id = $ this -> getMapID ( ) ; $ class = $ this -> getMapClass ( ) ; $ style = $ this -> getMapStyle ( ) ; $ output = "<div id='{$id}'" ; if ( ! empty ( $ class ) ) { $ output .= " class='{$class}'" ; } if ( ! empty ( $ style ) ) { $ output .= " style='{$style}'" ; } $ output .= '></div>'...
Method to retrieve the div that the map is loaded into
17,938
public function render ( $ type = 'html' ) { $ row = $ this -> getTable ( ) -> getRow ( ) -> getActualRow ( ) ; $ value = '' ; if ( is_array ( $ row ) || $ row instanceof \ ArrayAccess ) { $ value = ( isset ( $ row [ $ this -> getHeader ( ) -> getName ( ) ] ) ) ? $ row [ $ this -> getHeader ( ) -> getName ( ) ] : '' ; ...
Rendering single cell
17,939
public static function increment ( $ string , $ style = 'default' , $ n = 0 ) { $ styleSpec = isset ( self :: $ incrementStyles [ $ style ] ) ? self :: $ incrementStyles [ $ style ] : self :: $ incrementStyles [ 'default' ] ; if ( is_array ( $ styleSpec [ 0 ] ) ) { $ rxSearch = $ styleSpec [ 0 ] [ 0 ] ; $ rxReplace = $...
Increments a trailing number in a string .
17,940
public static function strpos ( $ str , $ search , $ offset = false ) { if ( $ offset === false ) { return utf8_strpos ( $ str , $ search ) ; } else { return utf8_strpos ( $ str , $ search , $ offset ) ; } }
UTF - 8 aware alternative to strpos .
17,941
public function renderDataTableJson ( ) { $ res = array ( ) ; $ render = $ this -> getTable ( ) -> getRow ( ) -> renderRows ( 'array' ) ; $ res [ 'sEcho' ] = $ render ; $ res [ 'iTotalDisplayRecords' ] = $ this -> getTable ( ) -> getSource ( ) -> getPaginator ( ) -> getTotalItemCount ( ) ; $ res [ 'aaData' ] = $ render...
Rendering json for dataTable
17,942
public function renderDataTableAjaxInit ( ) { $ renderedHeads = $ this -> renderHead ( ) ; $ view = new \ Zend \ View \ Model \ ViewModel ( ) ; $ view -> setTemplate ( 'data-table-init' ) ; $ view -> setVariable ( 'headers' , $ renderedHeads ) ; $ view -> setVariable ( 'attributes' , $ this -> getTable ( ) -> getAttrib...
Rendering init view for dataTable
17,943
public function renderParamsWrap ( ) { $ view = new \ Zend \ View \ Model \ ViewModel ( ) ; $ view -> setTemplate ( 'default-params' ) ; $ view -> setVariable ( 'column' , $ this -> getTable ( ) -> getParamAdapter ( ) -> getColumn ( ) ) ; $ view -> setVariable ( 'itemCountPerPage' , $ this -> getTable ( ) -> getParamAd...
Rendering params wrap to ajax communication
17,944
protected function initRenderer ( ) { $ renderer = new PhpRenderer ( ) ; $ plugins = $ renderer -> getHelperPluginManager ( ) ; $ config = new \ Zend \ Form \ View \ HelperConfig ; $ config -> configureServiceManager ( $ plugins ) ; $ resolver = new Resolver \ AggregateResolver ( ) ; $ map = new Resolver \ TemplateMapR...
Init renderer object
17,945
public function create ( $ owner , $ repo , $ org = '' ) { $ path = '/repos/' . $ owner . '/' . $ repo . '/forks' ; if ( strlen ( $ org ) > 0 ) { $ data = json_encode ( array ( 'org' => $ org ) ) ; } else { $ data = json_encode ( array ( ) ) ; } return $ this -> processResponse ( $ this -> client -> post ( $ this -> fe...
Method to fork a repository .
17,946
public function addCondition ( $ name , $ options ) { if ( $ this instanceof DataAccessInterface ) { $ condition = ConditionFactory :: factory ( $ name , $ options ) ; $ condition -> setDecorator ( $ this ) ; $ this -> attachCondition ( $ condition ) ; return $ this ; } }
Add new condition to decorator
17,947
public function validConditions ( ) { if ( ! count ( $ this -> conditions ) ) { return true ; } foreach ( $ this -> conditions as $ condition ) { if ( ! $ condition -> isValid ( ) ) { return false ; } } return true ; }
Check if all conditions are valid
17,948
public function post ( $ url , $ data , array $ headers = null , $ timeout = null ) { return $ this -> makeTransportRequest ( 'POST' , $ url , $ data , $ headers , $ timeout ) ; }
Method to send the POST command to the server .
17,949
public function put ( $ url , $ data , array $ headers = null , $ timeout = null ) { return $ this -> makeTransportRequest ( 'PUT' , $ url , $ data , $ headers , $ timeout ) ; }
Method to send the PUT command to the server .
17,950
public function addCall ( $ method , $ params = array ( ) ) { $ call = array ( 'name' => $ method , 'params' => $ params ) ; $ calls = $ this -> listCalls ( ) ; $ calls [ ] = $ call ; $ this -> setOption ( 'calls' , $ calls ) ; return $ call ; }
Add an analytics call
17,951
public function createCall ( $ method , $ params = array ( ) ) { $ params = array_values ( $ params ) ; if ( $ this -> isAsync ( ) ) { $ output = "_gaq.push(['{$method}'," ; $ output .= substr ( json_encode ( $ params ) , 1 , - 1 ) ; $ output .= ']);' ; } else { $ output = "pageTracker.{$method}(" ; $ output .= substr ...
Create a javascript function from the call parameters
17,952
public function addCustomVar ( $ slot , $ name , $ value , $ scope = 3 ) { return $ this -> addCall ( '_setCustomVar' , array ( $ slot , $ name , $ value , $ scope ) ) ; }
Add a custom variable to the analytics
17,953
public function createCustomVar ( $ slot , $ name , $ value , $ scope = 3 ) { return $ this -> createCall ( '_setCustomVar' , array ( $ slot , $ name , $ value , $ scope ) ) ; }
Get the code to create a custom analytics variable
17,954
public function addEvent ( $ category , $ action , $ label = null , $ value = null , $ noninteract = false ) { return $ this -> addCall ( '_trackEvent' , array ( $ category , $ action , $ label , $ value , $ noninteract ) ) ; }
Track an analytics event
17,955
public function createEvent ( $ category , $ action , $ label = null , $ value = null , $ noninteract = false ) { return $ this -> createCall ( '_trackEvent' , array ( $ category , $ action , $ label , $ value , $ noninteract ) ) ; }
Get the code to track an analytics event
17,956
public function getHeader ( ) { if ( ! $ this -> isAsync ( ) ) { return '' ; } if ( ! $ this -> getOption ( 'code' ) ) { throw new UnexpectedValueException ( 'A Google Analytics tracking code is required.' ) ; } $ code = $ this -> getOption ( 'code' ) ; $ output = '<script type="text/javascript">' ; $ output .= 'var _g...
Get code to load Google Analytics javascript
17,957
public function getBody ( ) { if ( ! $ this -> getOption ( 'code' ) ) { throw new UnexpectedValueException ( 'A Google Analytics tracking code is required.' ) ; } $ prefix = $ this -> isSecure ( ) ? 'https://ssl' : 'http://www' ; $ code = $ this -> getOption ( 'code' ) ; if ( $ this -> isAsync ( ) ) { $ output = '<scri...
Google Analytics only needs to be included in the header
17,958
protected function initFilters ( $ query ) { if ( $ value = $ this -> getParamAdapter ( ) -> getValueOfFilter ( 'name' ) ) { $ query -> where ( $ query -> expr ( ) -> like ( 'q.name' , '?1' ) ) -> setParameter ( '1' , '%' . $ value . '%' ) ; } if ( $ value = $ this -> getParamAdapter ( ) -> getValueOfFilter ( 'surname'...
The filters could also be done with a parametrised query
17,959
public function getRateLimit ( ) { $ path = '/rate_limit' ; $ response = $ this -> client -> get ( $ this -> fetchUrl ( $ path ) ) ; if ( $ response -> code != 200 ) { if ( $ response -> code == 404 ) { return ( object ) array ( 'limit' => false , 'remaining' => null ) ; } $ error = json_decode ( $ response -> body ) ;...
Method to get the rate limit for the authenticated user .
17,960
public function listComments ( $ activityId , $ fields = null , $ max = 20 , $ order = null , $ token = null , $ alt = null ) { if ( $ this -> isAuthenticated ( ) ) { $ url = $ this -> getOption ( 'api.url' ) . 'activities/' . $ activityId . '/comments' ; if ( $ fields ) { $ url .= '?fields=' . $ fields ; } if ( $ max ...
List all of the comments for an activity .
17,961
public static function ftpChmod ( $ url , $ mode ) { $ sch = parse_url ( $ url , PHP_URL_SCHEME ) ; if ( ( $ sch != 'ftp' ) && ( $ sch != 'ftps' ) ) { return false ; } $ server = parse_url ( $ url , PHP_URL_HOST ) ; $ port = parse_url ( $ url , PHP_URL_PORT ) ; $ path = parse_url ( $ url , PHP_URL_PATH ) ; $ user = par...
Quick FTP chmod
17,962
public static function getJStreams ( ) { static $ streams = array ( ) ; if ( ! $ streams ) { $ files = new \ DirectoryIterator ( __DIR__ . '/Stream' ) ; foreach ( $ files as $ file ) { if ( ! $ file -> isFile ( ) || $ file -> getExtension ( ) != 'php' ) { continue ; } $ streams [ ] = $ file -> getBasename ( '.php' ) ; ...
Returns a list of J! streams
17,963
public function createSavedSearch ( $ query ) { $ path = '/saved_searches/create.json' ; $ data [ 'query' ] = rawurlencode ( $ query ) ; return $ this -> sendRequest ( $ path , 'POST' , $ data ) ; }
Method to create a new saved search for the authenticated user .
17,964
public function get ( ) { $ response = $ this -> client -> get ( $ this -> fetchUrl ( '/zen' ) ) ; if ( 200 != $ response -> code ) { throw new \ RuntimeException ( 'Can\'t get a Zen' ) ; } return $ response -> body ; }
Get a random response about one of our design philosophies .
17,965
protected function asArray ( $ data ) { $ array = array ( ) ; if ( is_object ( $ data ) ) { $ data = get_object_vars ( $ data ) ; } foreach ( $ data as $ k => $ v ) { if ( is_object ( $ v ) || is_array ( $ v ) ) { $ array [ $ k ] = $ this -> asArray ( $ v ) ; } else { $ array [ $ k ] = $ v ; } } return $ array ; }
Method to recursively convert an object of data to an array .
17,966
public function search ( $ fields = null , $ keywords = null , $ hq = false , $ facets = null , $ facet = null , $ start = 0 , $ count = 0 , $ sort = null ) { $ token = $ this -> oauth -> getToken ( ) ; $ parameters = array ( 'oauth_token' => $ token [ 'key' ] ) ; $ base = '/v1/company-search' ; $ data [ 'format' ] = '...
Method to search across company pages .
17,967
public function get ( $ user , $ repo , $ name ) { $ path = '/repos/' . $ user . '/' . $ repo . '/labels/' . $ name ; return $ this -> processResponse ( $ response = $ this -> client -> get ( $ this -> fetchUrl ( $ path ) ) ) ; }
Method to get a specific label on a repo .
17,968
public function create ( $ owner , $ repo , $ name , $ color ) { $ path = '/repos/' . $ owner . '/' . $ repo . '/labels' ; $ data = json_encode ( array ( 'name' => $ name , 'color' => $ color ) ) ; $ response = $ this -> client -> post ( $ this -> fetchUrl ( $ path ) , $ data ) ; if ( $ response -> code != 201 ) { $ er...
Method to create a label on a repo .
17,969
public function add ( $ owner , $ repo , $ number , array $ labels ) { $ path = '/repos/' . $ owner . '/' . $ repo . '/issues/' . $ number . '/labels' ; return $ this -> processResponse ( $ this -> client -> post ( $ this -> fetchUrl ( $ path ) , json_encode ( $ labels ) ) ) ; }
Add labels to an issue .
17,970
public function replace ( $ owner , $ repo , $ number , array $ labels ) { $ path = '/repos/' . $ owner . '/' . $ repo . '/issues/' . $ number . '/labels' ; return $ this -> processResponse ( $ this -> client -> put ( $ this -> fetchUrl ( $ path ) , json_encode ( $ labels ) ) ) ; }
Replace all labels for an issue .
17,971
public function check ( $ user ) { $ path = '/user/following/' . $ user ; $ response = $ this -> client -> get ( $ this -> fetchUrl ( $ path ) ) ; switch ( $ response -> code ) { case '204' : return true ; break ; case '404' : return false ; break ; default : throw new \ UnexpectedValueException ( 'Unexpected response ...
Check if you are following a user .
17,972
public function follow ( $ user ) { $ path = '/user/following/' . $ user ; return $ this -> processResponse ( $ this -> client -> put ( $ this -> fetchUrl ( $ path ) , '' ) , 204 ) ; }
Follow a user .
17,973
public function unfollow ( $ user ) { $ path = '/user/following/' . $ user ; return $ this -> processResponse ( $ this -> client -> delete ( $ this -> fetchUrl ( $ path ) ) , 204 ) ; }
Unfollow a user .
17,974
public function create ( $ user , $ repo , $ pullId , $ body , $ commitId , $ filePath , $ position ) { $ path = '/repos/' . $ user . '/' . $ repo . '/pulls/' . ( int ) $ pullId . '/comments' ; $ data = json_encode ( array ( 'body' => $ body , 'commit_id' => $ commitId , 'path' => $ filePath , 'position' => $ position ...
Method to create a comment on a pull request .
17,975
public function createReply ( $ user , $ repo , $ pullId , $ body , $ inReplyTo ) { $ path = '/repos/' . $ user . '/' . $ repo . '/pulls/' . ( int ) $ pullId . '/comments' ; $ data = json_encode ( array ( 'body' => $ body , 'in_reply_to' => ( int ) $ inReplyTo ) ) ; return $ this -> processResponse ( $ this -> client -...
Method to create a comment in reply to another comment .
17,976
public function get ( $ object ) { if ( $ this -> oauth != null ) { if ( $ this -> oauth -> isAuthenticated ( ) ) { $ response = $ this -> oauth -> query ( $ this -> fetchUrl ( $ object ) ) ; return json_decode ( $ response -> body ) ; } else { return false ; } } return $ this -> sendRequest ( $ object ) ; }
Method to get an object .
17,977
public function getConnection ( $ object , $ connection = null , $ extra_fields = '' , $ limit = 0 , $ offset = 0 , $ until = null , $ since = null ) { $ path = $ object . '/' . $ connection . $ extra_fields ; if ( $ this -> oauth != null ) { if ( $ this -> oauth -> isAuthenticated ( ) ) { $ response = $ this -> oauth ...
Method to get object s connection .
17,978
public function createConnection ( $ object , $ connection = null , $ parameters = null , array $ headers = null ) { if ( $ this -> oauth -> isAuthenticated ( ) ) { if ( $ connection != null ) { $ path = $ object . '/' . $ connection ; } else { $ path = $ object ; } $ response = $ this -> oauth -> query ( $ this -> fet...
Method to create a connection .
17,979
public static function isOwner ( $ path ) { $ tmp = md5 ( mt_rand ( ) ) ; $ ssp = ini_get ( 'session.save_path' ) ; $ jtp = JPATH_ROOT . '/tmp' ; $ dir = is_writable ( '/tmp' ) ? '/tmp' : false ; $ dir = ( ! $ dir && is_writable ( $ ssp ) ) ? $ ssp : false ; $ dir = ( ! $ dir && is_writable ( $ jtp ) ) ? $ jtp : false ...
Method to determine if script owns the path .
17,980
public function getLists ( $ user , $ reverse = null ) { $ this -> checkRateLimit ( 'lists' , 'list' ) ; if ( is_numeric ( $ user ) ) { $ data [ 'user_id' ] = $ user ; } elseif ( is_string ( $ user ) ) { $ data [ 'screen_name' ] = $ user ; } else { throw new \ RuntimeException ( 'The specified username is not in the co...
Method to get all lists the authenticating or specified user subscribes to including their own .
17,981
public function create ( $ name , $ mode = null , $ description = null ) { $ this -> checkRateLimit ( 'lists' , 'create' ) ; $ data = array ( ) ; if ( $ name ) { $ data [ 'name' ] = $ name ; } if ( $ mode ) { $ data [ 'mode' ] = $ mode ; } if ( $ description ) { $ data [ 'description' ] = $ description ; } $ path = '/l...
Method to create a new list for the authenticated user .
17,982
protected function getInput ( ) { $ accept = $ this -> element [ 'accept' ] ? ' accept="' . ( string ) $ this -> element [ 'accept' ] . '"' : '' ; $ size = $ this -> element [ 'size' ] ? ' size="' . ( int ) $ this -> element [ 'size' ] . '"' : '' ; $ class = $ this -> element [ 'class' ] ? ' class="' . ( string ) $ thi...
Method to get the field input markup for the file field . Field attributes allow specification of a maximum file size and a string of accepted file extensions .
17,983
public function stream_open ( $ path , $ mode , $ options , & $ opened_path ) { $ url = parse_url ( $ path ) ; $ this -> name = $ url [ 'host' ] ; $ this -> buffers [ $ this -> name ] = null ; $ this -> position = 0 ; return true ; }
Function to open file or url
17,984
public function create ( $ user , $ repo , $ title , $ body = null , $ assignee = null , $ milestone = null , array $ labels = null ) { $ path = '/repos/' . $ user . '/' . $ repo . '/issues' ; if ( isset ( $ labels ) ) { $ labels = array_values ( $ labels ) ; } $ data = json_encode ( array ( 'title' => $ title , 'assig...
Method to create an issue .
17,985
public function edit ( $ user , $ repo , $ issueId , $ state = null , $ title = null , $ body = null , $ assignee = null , $ milestone = null , array $ labels = null ) { $ path = '/repos/' . $ user . '/' . $ repo . '/issues/' . ( int ) $ issueId ; $ data = new \ stdClass ; if ( isset ( $ title ) ) { $ data -> title = $...
Method to update an issue .
17,986
public function getList ( $ filter = null , $ state = null , $ labels = null , $ sort = null , $ direction = null , Date $ since = null , $ page = 0 , $ limit = 0 ) { $ path = '/issues' ; $ response = $ this -> client -> get ( $ this -> fetchUrl ( $ path , $ page , $ limit ) ) ; if ( $ response -> code != 200 ) { $ err...
Method to list an authenticated user s issues .
17,987
public function getListByRepository ( $ user , $ repo , $ milestone = null , $ state = null , $ assignee = null , $ mentioned = null , $ labels = null , $ sort = null , $ direction = null , Date $ since = null , $ page = 0 , $ limit = 0 ) { $ path = '/repos/' . $ user . '/' . $ repo . '/issues' ; $ uri = new Uri ( $ th...
Method to list issues .
17,988
public function getRepositoryList ( $ owner , $ repo , $ sort = 'created' , $ direction = 'asc' , Date $ since = null ) { $ path = '/repos/' . $ owner . '/' . $ repo . '/issues/comments' ; if ( false == in_array ( $ sort , array ( 'created' , 'updated' ) ) ) { throw new \ UnexpectedValueException ( sprintf ( '%1$s - so...
Method to get the list of comments in a repository .
17,989
public function create ( $ user , $ repo , $ issueId , $ body ) { $ path = '/repos/' . $ user . '/' . $ repo . '/issues/' . ( int ) $ issueId . '/comments' ; $ data = json_encode ( array ( 'body' => $ body , ) ) ; return $ this -> processResponse ( $ this -> client -> post ( $ this -> fetchUrl ( $ path ) , $ data ) , 2...
Method to create a comment on an issue .
17,990
public function createComment ( $ album , $ message ) { $ data = array ( ) ; $ data [ 'message' ] = $ message ; return $ this -> createConnection ( $ album , 'comments' , $ data ) ; }
Method to comment on an album . Requires authentication and publish_stream permission .
17,991
public function createFavorites ( $ id , $ entities = null ) { $ path = '/favorites/create.json' ; $ data [ 'id' ] = $ id ; if ( ! is_null ( $ entities ) ) { $ data [ 'include_entities' ] = $ entities ; } return $ this -> sendRequest ( $ path , 'POST' , $ data ) ; }
Method to favorite the status specified in the ID parameter as the authenticating user
17,992
public function getFriendshipsOutgoing ( $ cursor = null , $ string_ids = null ) { $ this -> checkRateLimit ( 'friendships' , 'outgoing' ) ; $ data = array ( ) ; if ( ! is_null ( $ cursor ) ) { $ data [ 'cursor' ] = $ cursor ; } if ( ! is_null ( $ string_ids ) ) { $ data [ 'stringify_ids' ] = $ string_ids ; } $ path = ...
Method to determine every protected user for whom the authenticating user has a pending follow request .
17,993
public function unfollow ( $ user ) { if ( is_numeric ( $ user ) ) { $ data [ 'user_id' ] = $ user ; } elseif ( is_string ( $ user ) ) { $ data [ 'screen_name' ] = $ user ; } else { throw new \ RuntimeException ( 'The specified username is not in the correct format; must use integer or string' ) ; } $ path = '/friendsh...
Allows the authenticating users to unfollow the user specified in the ID parameter .
17,994
public function getFriendshipsLookup ( $ screen_name = null , $ id = null ) { $ this -> checkRateLimit ( 'friendships' , 'lookup' ) ; $ data = array ( ) ; if ( $ id ) { $ data [ 'user_id' ] = $ id ; } if ( $ screen_name ) { $ data [ 'screen_name' ] = $ screen_name ; } if ( $ id == null && $ screen_name == null ) { thro...
Method to get the relationship of the authenticating user to the comma separated list of up to 100 screen_names or user_ids provided .
17,995
public function searchUsers ( $ query , $ page = 0 , $ count = 0 , $ entities = null ) { $ this -> checkRateLimit ( 'users' , 'search' ) ; $ data [ 'q' ] = rawurlencode ( $ query ) ; if ( $ page > 0 ) { $ data [ 'page' ] = $ page ; } if ( $ count > 0 ) { $ data [ 'count' ] = $ count ; } if ( ! is_null ( $ entities ) ) ...
Method used to search for users
17,996
public function getSuggestions ( $ lang = null ) { $ this -> checkRateLimit ( 'users' , 'suggestions' ) ; $ path = '/users/suggestions.json' ; $ data = array ( ) ; if ( $ lang ) { $ data [ 'lang' ] = $ lang ; } return $ this -> sendRequest ( $ path , 'GET' , $ data ) ; }
Method access to Twitter s suggested user list .
17,997
public function getSuggestionsSlug ( $ slug , $ lang = null ) { $ this -> checkRateLimit ( 'users' , 'suggestions/:slug' ) ; $ path = '/users/suggestions/' . $ slug . '.json' ; $ data = array ( ) ; if ( $ lang ) { $ data [ 'lang' ] = $ lang ; } return $ this -> sendRequest ( $ path , 'GET' , $ data ) ; }
method to access the users in a given category of the Twitter suggested user list .
17,998
public function renderRows ( $ type = 'html' ) { if ( $ type == 'html' ) { return $ this -> renderRowHtml ( ) ; } elseif ( $ type == 'array' ) { return $ this -> renderRowArray ( ) ; } elseif ( $ type == 'array_assc' ) { return $ this -> renderRowArray ( 'assc' ) ; } else { throw new Exception \ InvalidArgumentExceptio...
Rendering all rows for table
17,999
private function renderRowArray ( $ type = 'normal' ) { $ data = $ this -> getTable ( ) -> getData ( ) ; $ headers = $ this -> getTable ( ) -> getHeaders ( ) ; $ render = array ( ) ; foreach ( $ data as $ rowData ) { $ this -> setActualRow ( $ rowData ) ; $ temp = array ( ) ; foreach ( $ headers as $ name => $ options ...
Rendering rows as array