idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
9,700
public function wait ( $ action ) { $ lead = $ this -> conversation -> get ( 'lead' ) ; if ( $ lead != null ) { $ lead -> data ( '_wait' , $ action ) ; } else { $ this -> model -> addIntendedAction ( $ action ) ; } }
Named Intended Action
9,701
public function keep ( $ messages ) { $ previous_intended_action = $ this -> conversation -> get ( 'previous_intended_action' ) ; if ( $ previous_intended_action == null ) { return ; } $ this -> says ( $ messages ) -> wait ( $ previous_intended_action ) ; }
Keep staying in current intended action .
9,702
public function clean ( array $ entry ) { $ entry [ 'id' ] = $ entry [ 'dn' ] ; $ entry [ 'remember_token' ] = $ entry [ 'dn' ] ; $ entry [ 'username' ] = $ entry [ 'samaccountname' ] [ 0 ] ; $ entry [ 'type' ] = 1 ; $ entry [ 'group' ] = '' ; if ( count ( $ this -> config [ 'groups' ] ) > 0 ) { $ entry [ 'type' ] = NU...
Cleans the data for the LDAP model including some additional fields .
9,703
protected function getPriority ( $ command , array $ params ) { $ priority = new EventQueuePriority ; $ priority -> value = $ this -> priorities [ $ command ] ; $ priority -> timestamp = ( int ) ( microtime ( true ) * 10000 ) ; if ( $ priority -> timestamp <= $ this -> lastTimestamp ) { $ priority -> timestamp = $ this...
Returns the priority of a specified command .
9,704
protected function queueRequest ( UserEventInterface $ event , $ command , array $ params ) { $ event -> setPrefix ( $ this -> prefix ) ; $ event -> setCommand ( $ command ) ; $ event -> setParams ( array_filter ( $ params , 'strlen' ) ) ; $ this -> queue -> insert ( $ event , $ this -> getPriority ( $ command , $ para...
Enqueues a new event .
9,705
protected function queueCtcpEvent ( $ command , $ ctcpCommand , array $ params = [ ] ) { $ event = new CtcpEvent ; $ event -> setCtcpCommand ( $ ctcpCommand ) ; $ this -> queueRequest ( $ event , $ command , $ params ) ; }
Enqueues a new CTCP event .
9,706
public function getKey ( ) { if ( ! $ this -> decrypted_key ) { $ decoded_ciphertextblob = base64_decode ( $ this -> key_description -> getCiphertextBlob ( ) , true ) ; if ( ! $ decoded_ciphertextblob ) { throw new FetchException ( 'CiphertextBlob should be a valid base64 encoded string' ) ; } $ options = [ 'Ciphertext...
Return KMS decrypted key
9,707
public function encrypt ( $ plaintext , $ key ) { $ crypt_aes = $ this -> setupAES256 ( $ key ) ; return $ crypt_aes -> encrypt ( $ plaintext ) ; }
Use \ phpseclib \ Crypt \ AES to encrypt plaintext using given key
9,708
public function encrypt ( $ plaintext ) { $ key = $ this -> provider -> getKey ( ) ; return $ this -> cipher -> encrypt ( $ plaintext , $ key ) ; }
Encrypt plaintext using given cypher and provided key
9,709
public function show ( $ id ) { $ vault = $ this -> client -> get ( sprintf ( 'buckets/%d/vaults/%d.json' , $ this -> bucket , $ id ) ) ; return new Vault ( $ this -> response ( $ vault ) ) ; }
Get a vault .
9,710
public function show ( $ id ) { $ inbox = $ this -> client -> get ( sprintf ( 'buckets/%d/inboxes/%d.json' , $ this -> bucket , $ id ) ) ; return new Inbox ( $ this -> response ( $ inbox ) ) ; }
Get an inbox .
9,711
public function reposition ( $ position ) { return Basecamp :: todoListGroups ( $ this -> bucket -> id ) -> reposition ( $ this -> id , $ position ) ; }
Reposition the to - do list group .
9,712
public function createOrUpdateUserByLoginEmail ( $ data ) { if ( ! isset ( $ data [ 'login' ] ) ) { throw new \ Exception ( sprintf ( 'Have to specify $data[login].' ) ) ; } $ data [ 'principal-id' ] = $ this -> getUserByLoginEmail ( $ data [ 'login' ] , true ) ; return $ this -> createOrUpdateUser ( $ data ) ; }
Update an user by email or create it if not exist .
9,713
public function createOrUpdateUser ( $ data ) { if ( ! isset ( $ data [ 'login' ] ) && isset ( $ data [ 'email' ] ) ) { $ data [ 'login' ] = $ data [ 'email' ] ; } elseif ( ! isset ( $ data [ 'email' ] ) && isset ( $ data [ 'login' ] ) ) { $ data [ 'email' ] = $ data [ 'login' ] ; } if ( isset ( $ data [ 'principal-id'...
Create or Update an user according if principal - id is present on the data
9,714
public function put ( $ key , $ value ) { if ( isset ( $ this -> data [ $ key ] ) ) { $ this -> data [ $ key ] = $ value ; $ this -> recordAccess ( $ key ) ; } else { $ this -> data [ $ key ] = $ value ; if ( $ this -> size ( ) > $ this -> maximumSize ) { reset ( $ this -> data ) ; unset ( $ this -> data [ key ( $ this...
Put something in the cache
9,715
public function remove ( $ key ) { if ( isset ( $ this -> data [ $ key ] ) ) { $ value = $ this -> data [ $ key ] ; unset ( $ this -> data [ $ key ] ) ; return $ value ; } else { return null ; } }
Remove the element with this key .
9,716
protected function recordAccess ( $ key ) { $ value = $ this -> data [ $ key ] ; unset ( $ this -> data [ $ key ] ) ; $ this -> data [ $ key ] = $ value ; }
Moves the element from current position to end of array
9,717
public function index ( $ page = null ) { $ url = sprintf ( 'buckets/%d/message_boards/%d/messages.json' , $ this -> bucket , $ this -> parent ) ; $ messages = $ this -> client -> get ( $ url , [ 'query' => [ 'page' => $ page , ] , ] ) ; return $ this -> indexResponse ( $ messages , Message :: class ) ; }
Index all messages .
9,718
public function store ( $ data ) { $ message = $ this -> client -> post ( sprintf ( 'buckets/%d/message_boards/%d/messages.json' , $ this -> bucket , $ this -> parent ) , [ 'json' => $ data , ] ) ; return new Message ( $ this -> response ( $ message ) ) ; }
Store a message .
9,719
public function update ( $ id , $ data ) { $ message = $ this -> client -> put ( sprintf ( 'buckets/%d/messages/%d.json' , $ this -> bucket , $ id ) , [ 'json' => $ data , ] ) ; return new Message ( $ this -> response ( $ message ) ) ; }
Update a message .
9,720
public function getParams ( ) { $ params = [ ] ; foreach ( $ this as $ key => $ value ) { $ pname = ( string ) ltrim ( strtolower ( preg_replace ( '/[A-Z]/' , '_$0' , $ key ) ) , '_' ) ; $ params [ $ pname ] = $ value ; } return $ params ; }
Convert properties to array with snake_case properties
9,721
public function update ( array $ data ) { $ todo = Basecamp :: todos ( $ this -> bucket -> id ) -> update ( $ this -> id , $ data ) ; $ this -> setAttributes ( $ todo ) ; return $ todo ; }
Update the to - do .
9,722
public function reposition ( $ position ) { return Basecamp :: todos ( $ this -> bucket -> id ) -> reposition ( $ this -> id , $ position ) ; }
Reposition the to - do .
9,723
protected function cacheCssAssetFiles ( ) { $ this -> cacheMediaAssetFiles ( ) ; if ( $ this -> getOptions ( ) -> isProduction ( ) ) { $ oAssetFileFiltersManager = $ this -> getAssetFileFiltersManager ( ) ; $ oCssFileFilter = $ oAssetFileFiltersManager -> has ( \ AssetsBundle \ AssetFile \ AssetFile :: ASSET_CSS ) ? $ ...
Cache Css asset files and retrieve cached asset files
9,724
protected function cacheLessAssetFiles ( ) { $ oTmpAssetFile = $ this -> createTmpAssetFile ( \ AssetsBundle \ AssetFile \ AssetFile :: ASSET_LESS ) ; $ oAssetFilesCacheManager = $ this -> getAssetFilesCacheManager ( ) ; if ( $ this -> getOptions ( ) -> isProduction ( ) ) { $ oTmpAssetFile -> setAssetFileType ( \ Asset...
Cache Less asset files and retrieve cached asset files
9,725
protected function cacheJsAssetFiles ( ) { if ( $ this -> getOptions ( ) -> isProduction ( ) ) { $ oAssetFileFiltersManager = $ this -> getAssetFileFiltersManager ( ) ; $ oJsFileFilter = $ oAssetFileFiltersManager -> has ( \ AssetsBundle \ AssetFile \ AssetFile :: ASSET_JS ) ? $ oAssetFileFiltersManager -> get ( \ Asse...
Cache Js asset files and retrieve cached asset files
9,726
protected function cacheMediaAssetFiles ( ) { $ aAssetFileFilters = array ( ) ; $ aAssetFiles = array ( ) ; $ oAssetFilesCacheManager = $ this -> getAssetFilesCacheManager ( ) ; $ oAssetFileFiltersManager = $ this -> getAssetFileFiltersManager ( ) ; $ bIsProduction = $ this -> getOptions ( ) -> isProduction ( ) ; forea...
Cache media asset files and retrieve cached asset files
9,727
public function rewriteAssetFileUrls ( $ sAssetFileContent , \ AssetsBundle \ AssetFile \ AssetFile $ oAssetFile ) { $ oRewriteUrlCallback = array ( $ this , 'rewriteUrl' ) ; return preg_replace_callback ( '/url\(([^\)]+)\)/' , function ( $ aMatches ) use ( $ oAssetFile , $ oRewriteUrlCallback ) { return call_user_func...
Rewrite url of an asset file content to match with cache path if needed
9,728
public function rewriteUrl ( array $ aMatches , \ AssetsBundle \ AssetFile \ AssetFile $ oAssetFile ) { if ( ! isset ( $ aMatches [ 1 ] ) ) { throw new \ InvalidArgumentException ( 'Url match is not valid' ) ; } $ aFirstCharMatches = null ; $ sFirstChar = preg_match ( '/^("|\'){1}/' , $ sUrl = trim ( $ aMatches [ 1 ] )...
Rewrite url to match with cache path if needed
9,729
public function setAssetFilesConfiguration ( \ AssetsBundle \ AssetFile \ AssetFilesConfiguration $ oAssetFilesConfiguration ) { $ this -> assetFilesConfiguration = $ oAssetFilesConfiguration -> setOptions ( $ this -> getOptions ( ) ) ; return $ this ; }
Set the asset files configuration
9,730
public function getAssetFilesConfiguration ( ) { if ( ! $ this -> assetFilesConfiguration instanceof \ AssetsBundle \ AssetFile \ AssetFilesConfiguration ) { $ this -> setAssetFilesConfiguration ( new \ AssetsBundle \ AssetFile \ AssetFilesConfiguration ( ) ) ; } return $ this -> assetFilesConfiguration ; }
Retrieve the asset files configuration . Lazy loads an instance if none currently set .
9,731
public function setAssetFileFiltersManager ( \ AssetsBundle \ AssetFile \ AssetFileFiltersManager $ oAssetFileFiltersManager ) { $ this -> assetFileFiltersManager = $ oAssetFileFiltersManager -> setOptions ( $ this -> getOptions ( ) ) ; return $ this ; }
Set the asset file filters manager
9,732
public function getAssetFileFiltersManager ( ) { if ( ! $ this -> assetFileFiltersManager instanceof \ AssetsBundle \ AssetFile \ AssetFileFiltersManager ) { $ this -> setAssetFileFiltersManager ( new \ AssetsBundle \ AssetFile \ AssetFileFiltersManager ( ) ) ; } return $ this -> assetFileFiltersManager ; }
Retrieve the asset file filters manager . Lazy loads an instance if none currently set .
9,733
public function setAssetFilesCacheManager ( \ AssetsBundle \ AssetFile \ AssetFilesCacheManager $ oAssetFilesCacheManager ) { $ this -> assetFilesCacheManager = $ oAssetFilesCacheManager -> setOptions ( $ this -> getOptions ( ) ) ; return $ this ; }
Set the asset files cache manager
9,734
public function getAssetFilesCacheManager ( ) { if ( ! $ this -> assetFilesCacheManager instanceof \ AssetsBundle \ AssetFile \ AssetFilesCacheManager ) { $ this -> setAssetFilesCacheManager ( new \ AssetsBundle \ AssetFile \ AssetFilesCacheManager ( ) ) ; } return $ this -> assetFilesCacheManager ; }
Retrieve the asset files cache manager . Lazy loads an instance if none currently set .
9,735
public function index ( $ page = null ) { $ url = 'people.json' ; $ people = $ this -> client -> get ( $ url , [ 'query' => [ 'page' => $ page , ] ] ) ; return $ this -> indexResponse ( $ people , Person :: class ) ; }
Get people .
9,736
public function inProject ( $ bucket , $ page = null ) { $ url = sprintf ( 'projects/%d/people.json' , $ bucket ) ; $ people = $ this -> client -> get ( $ url , [ 'query' => [ 'page' => $ page , ] , ] ) ; return $ this -> indexResponse ( $ people , Person :: class ) ; }
Get people on a project .
9,737
public function updateAccessToProject ( $ bucket , $ data ) { $ access = $ this -> client -> put ( sprintf ( 'projects/%d/people/users.json' , $ bucket ) , [ 'json' => $ data , ] ) ; return $ this -> response ( $ access ) ; }
Update an access to a project .
9,738
public function show ( $ id ) { $ person = $ this -> client -> get ( sprintf ( 'people/%d.json' , $ id ) ) ; return new Person ( $ this -> response ( $ person ) ) ; }
Get a person .
9,739
public function handle ( $ request , Closure $ next ) { $ response = $ next ( $ request ) ; if ( $ response instanceof Response ) { $ this -> setProfiles ( $ this -> getProfileConfig ( ) ) ; $ this -> setProfilesWithParameters ( func_get_args ( ) ) ; $ psr7Response = $ this -> createPsr7Response ( $ response ) ; $ psr7...
Handles an incoming request .
9,740
protected function createLaravelResponse ( ResponseInterface $ response ) { return new Response ( ( string ) $ response -> getBody ( ) , $ response -> getStatusCode ( ) , $ response -> getHeaders ( ) ) ; }
Creates Laravel response object from PSR 7 response .
9,741
protected function createPsr7Response ( Response $ response ) { return new PsrResponse ( $ response -> getStatusCode ( ) , $ response -> headers -> all ( ) , $ response -> getContent ( ) , $ response -> getProtocolVersion ( ) ) ; }
Creates PSR 7 response object from Laravel response .
9,742
protected function getProfileConfig ( ) { $ configCallable = $ this -> config ; $ config = $ configCallable ( $ this -> getProfileConfigKey ( ) ) ; if ( ! is_array ( $ config ) ) { $ config = [ $ config ] ; } return array_filter ( $ config ) ; }
Retrives profile configuration from Laravel config object .
9,743
protected function getProfilesFromArguments ( array $ arguments ) { $ profiles = [ ] ; if ( count ( $ arguments ) > 2 ) { unset ( $ arguments [ 0 ] ) ; unset ( $ arguments [ 1 ] ) ; $ profiles = $ arguments ; } return $ profiles ; }
Gets profiles from handle method arguments .
9,744
public function _loadArray ( ) { $ rawData = $ this -> getRawData ( ) ; $ value = $ this -> _postgresqlArrayDecode ( $ rawData ) ; $ value = $ value ? : [ ] ; $ this -> getModel ( ) -> setAttribute ( $ this -> getArrayFieldName ( ) , $ value ) ; return $ this ; }
Loads array field
9,745
protected function _postgresqlArrayDecode ( $ data , $ start = 0 ) { if ( empty ( $ data ) || $ data [ 0 ] != '{' ) { return null ; } $ result = [ ] ; $ string = false ; $ quote = '' ; $ len = strlen ( $ data ) ; $ v = '' ; for ( $ i = $ start + 1 ; $ i < $ len ; $ i ++ ) { $ ch = $ data [ $ i ] ; if ( ! $ string && $ ...
Decodes PostgreSQL array data into PHP array
9,746
public function _saveArray ( ) { $ value = $ this -> getModel ( ) -> getAttribute ( $ this -> getArrayFieldName ( ) ) ; ; $ value = $ this -> _postgresqlArrayEncode ( $ value ) ; if ( $ value === null && $ this -> onEmptySaveNull == false ) { $ value = '{}' ; } $ this -> getModel ( ) -> setAttribute ( $ this -> getArra...
Sets array field data into format suitable for save
9,747
protected function _postgresqlArrayEncode ( $ value ) { if ( empty ( $ value ) || ! is_array ( $ value ) ) { return null ; } $ result = '{' ; $ firstElem = true ; foreach ( $ value as $ elem ) { if ( ! $ firstElem ) { $ result .= ',' ; } if ( is_array ( $ elem ) ) { $ result .= $ this -> _postgresqlArrayEncode ( $ elem...
Encodes PHP array into PostgreSQL array data format
9,748
public function start ( ) { try { $ raw = file_get_contents ( php_sapi_name ( ) === 'cli' ? 'php://stdin' : 'php://input' ) ; if ( $ this -> rawInputHandler !== null ) { call_user_func ( $ this -> rawInputHandler , $ raw ) ; } $ request = new Request ( $ raw ) ; if ( array_key_exists ( $ request -> app , $ this -> cf )...
Starts the server .
9,749
protected function getFields ( ) { if ( false === $ this -> blameable ) { return false ; } if ( ! isset ( $ this -> fields ) ) { $ this -> fields = BlameableObserver :: findBlameableFields ( $ this , $ this -> blameable ) ; } return $ this -> fields ; }
Get blameable fields .
9,750
public function detach ( \ Zend \ EventManager \ EventManagerInterface $ oEvents ) { foreach ( $ this -> listeners as $ iIndex => $ oListener ) { if ( $ oEvents -> detach ( $ oListener ) ) { unset ( $ this -> listeners [ $ iIndex ] ) ; } } }
Detach aggregate listeners from the specified event manager
9,751
public function show ( $ id ) { $ questionnaire = $ this -> client -> get ( sprintf ( 'buckets/%d/questionnaires/%d.json' , $ this -> bucket , $ id ) ) ; return new Questionnaire ( $ this -> response ( $ questionnaire ) ) ; }
Get a questionnaire .
9,752
protected function getHttpClient ( ) { if ( is_null ( $ this -> httpClient ) ) { $ handlerStack = $ this -> createHandlerStack ( ) ; return new Guzzle ( [ 'base_uri' => rtrim ( $ this -> api [ 'href' ] , '/' ) . '/' , 'handler' => $ handlerStack , ] ) ; } return $ this -> httpClient ; }
Get the Http Client .
9,753
protected function createHandlerStack ( ) { $ stack = HandlerStack :: create ( new CurlHandler ( ) ) ; $ stack -> push ( ClientMiddlewares :: cache ( $ this -> cache ) ) ; $ stack -> push ( ClientMiddlewares :: setBaseHeaders ( $ this -> api [ 'token' ] , $ this -> config [ 'basecamp.user-agent' ] ) ) ; $ stack -> push...
Create an Handler Stack to pass Middlewares to Guzzle .
9,754
public function setRequestsPerTimeSpan ( $ requests ) { if ( ! is_numeric ( $ requests ) ) { throw new InvalidArgumentException ( 'requests per timespan is not numeric' ) ; } $ requests = ( int ) $ requests ; if ( $ requests < 1 ) { throw new InvalidArgumentException ( 'requests per timespan cannot be smaller than 1' )...
Sets the maximum number of requests allowed per timespan for a single entity .
9,755
public function setTimeSpan ( $ timeSpan ) { if ( is_string ( $ timeSpan ) ) { $ timeSpan = self :: parseTime ( $ timeSpan ) ; } if ( ! is_numeric ( $ timeSpan ) ) { throw new InvalidArgumentException ( 'timespan is not numeric' ) ; } $ timeSpan = floatval ( $ timeSpan ) ; if ( $ timeSpan <= 0 ) { throw new InvalidArgu...
Sets the timespan in which the defined number of requests is allowed per single entity .
9,756
public static function parseTime ( $ timeSpan ) { $ times = array ( 's' => 1 , 'm' => 60 , 'h' => 3600 , 'd' => 86400 , 'w' => 604800 ) ; $ matches = array ( ) ; if ( is_numeric ( $ timeSpan ) ) { return $ timeSpan ; } if ( preg_match ( '/^((\d+)?(\.\d+)?)(' . implode ( '|' , array_keys ( $ times ) ) . ')$/' , $ timeSp...
Parses a timespan string such as 10s 5m or 1h and returns the amount of seconds .
9,757
public function isViolator ( $ identifier ) { if ( $ this -> storage === null ) { throw new LogicException ( 'no storage set' ) ; } $ time = microtime ( true ) ; $ timestamp = $ time ; $ rate = ( float ) $ this -> requestsPerTimeSpan / $ this -> timeSpan ; $ identifier = 'leaky:' . sha1 ( $ rate . $ identifier ) ; $ re...
Returns whether entity exceeds it s allowed request capacity with this request .
9,758
public function principalInfo ( $ principal_id ) { $ response = $ this -> call ( 'principal-info' , array ( 'principal-id' => $ principal_id , ) ) ; return array ( 'contact' => current ( $ response -> xpath ( '/results/contact' ) ) , 'manager' => current ( $ response -> xpath ( '/results/manager' ) ) , 'preferences' =>...
Provides information about one principal either a user or a group .
9,759
public function permissionsUpdate ( $ acl_id , $ principal_id , $ permission_id ) { $ this -> call ( 'permissions-update' , array ( 'acl-id' => $ acl_id , 'principal-id' => $ principal_id , 'permission-id' => $ permission_id , ) ) ; return true ; }
Updates the permissions a principal has to access a SCO using a trio of principal - id acl - id and permission - id .
9,760
public function meetingFeatureUpdate ( $ account_id , $ feature_id , $ enable ) { $ response = $ this -> call ( 'meeting-feature-update' , array ( 'account-id' => $ account_id , 'feature-id' => $ feature_id , 'enable' => $ enable ) ) ; return true ; }
Enables or disables features in a meeting . This action is used to manage features such as recording of meetings and control of pods . For more information on usage see Configure compliance settings .
9,761
public function reportMeetingAttendance ( $ sco_id , $ filters = array ( ) ) { $ response = $ this -> call ( 'report-meeting-attendance' , array_merge ( array ( 'sco-id' => $ sco_id , ) , $ filters ) ) ; return $ response -> xpath ( '/results/report-meeting-attendance/row' ) ; }
Returns a list of users who attended a Adobe Connect meeting . The data is returned in row elements one for each person who attended . If the meeting hasn t started or had no attendees the response contains no rows . The response does not include meeting hosts or users who were invited but did not attend .
9,762
public function reportMeetingSessions ( $ sco_id , array $ filters = array ( ) ) { $ response = $ this -> call ( 'report-meeting-sessions' , array_merge ( array ( 'sco-id' => $ sco_id , ) , $ filters ) ) ; return $ response -> xpath ( '/results/report-meeting-sessions/row' ) ; }
Provides information about all the sessions of a Adobe Connect meeting . A session is created when a participant enters an empty meeting . As more participants join the meeting they join the session . The session ends when all attendees leave the meeting . When a new participant enters the now - empty meeting a new ses...
9,763
public function scoContents ( $ sco_id , array $ filters = array ( ) ) { $ response = $ this -> call ( 'sco-contents' , array_merge ( array ( 'sco-id' => $ sco_id , ) , $ filters ) ) ; return $ response -> xpath ( '/results/scos/sco' ) ; }
Returns a list of SCOs within another SCO . The enclosing SCO can be a folder meeting or curriculum .
9,764
public function scoExpandedContents ( $ sco_id , array $ filters = array ( ) ) { $ response = $ this -> call ( 'sco-expanded-contents' , array_merge ( array ( 'sco-id' => $ sco_id , ) , $ filters ) ) ; return $ response -> xpath ( '/results/expanded-scos/sco' ) ; }
Lists all of the SCOs in a folder including the contents of subfolders and any type of enclosing SCO .
9,765
public function scoInfo ( $ sco_id ) { $ response = $ this -> call ( 'sco-info' , array ( 'sco-id' => $ sco_id , ) ) ; return array ( 'sco' => current ( $ response -> xpath ( '/results/sco' ) ) , 'source-sco' => $ response -> xpath ( '/results/source-sco/source-sco' ) , ) ; }
Provides information about a SCO on Adobe Connect . The object can have any valid SCO type .
9,766
public function scoSearch ( $ query , array $ filters = array ( ) ) { $ response = $ this -> call ( 'sco-search' , array_merge ( array ( 'query' => $ query , ) , $ filters ) ) ; return $ response -> xpath ( '/results/sco-search-info/sco' ) ; }
Provides a list of all SCOs that have content matching the search text .
9,767
public static function getField ( string $ name = null ) : string { $ name = $ name ? : self :: $ currentName ; return sprintf ( '<input type="text" name="%s">' , $ name ) ; }
Build a new honeypot field .
9,768
public static function getHiddenField ( string $ name = null ) : string { $ name = $ name ? : self :: $ currentName ; return sprintf ( '<input type="text" name="%s" style="display: none">' , $ name ) ; }
Build a new honeypot field hidden via inline CSS .
9,769
public function show ( $ id ) { $ projectConstructions = $ this -> client -> get ( sprintf ( 'templates/%d/project_constructions/%d.json' , $ this -> parent , $ id ) ) ; return $ this -> response ( $ projectConstructions ) ; }
Get a project construction .
9,770
public function store ( array $ data ) { $ projectConstruction = $ this -> client -> post ( sprintf ( 'templates/%d/project_constructions.json' , $ this -> parent ) , [ 'json' => $ data , ] ) ; return $ this -> response ( $ projectConstruction ) ; }
Create a project construction .
9,771
public function store ( $ name , $ path ) { $ rawData = file_get_contents ( $ path ) ; $ attachment = $ this -> client -> post ( 'attachments.json' , [ 'query' => [ 'name' => $ name , ] , 'body' => $ rawData , 'headers' => [ 'Content-Type' => mime_content_type ( $ path ) , 'Content-Length' => filesize ( $ path ) , ] , ...
Store a new attachment .
9,772
public function get_error_message ( $ field , $ value , $ validator ) { return $ validator -> get_label ( $ field ) . ' must match ' . $ validator -> get_label ( $ this -> compare_against ) ; }
Return error message for this Rule
9,773
public function index ( $ page = null ) { $ url = 'chats.json' ; $ campfires = $ this -> client -> get ( $ url , [ 'query' => [ 'page' => $ page , ] , ] ) ; return $ this -> indexResponse ( $ campfires , Campfire :: class ) ; }
Index all campfires .
9,774
public function show ( $ id ) { $ campfire = $ this -> client -> get ( sprintf ( 'buckets/%d/chats/%d.json' , $ this -> bucket , $ id ) ) ; return new Campfire ( $ this -> response ( $ campfire ) ) ; }
Get a campfire .
9,775
public function lines ( $ page = null ) { $ url = sprintf ( 'buckets/%d/chats/%d/lines.json' , $ this -> bucket , $ this -> parent ) ; $ lines = $ this -> client -> get ( $ url , [ 'query' => [ 'page' => $ page , ] ] ) ; return $ this -> indexResponse ( $ lines , CampfireLine :: class ) ; }
Get a campfire lines .
9,776
public function line ( $ line ) { $ line = $ this -> client -> get ( sprintf ( 'buckets/%d/chats/%d/lines/%d.json' , $ this -> bucket , $ this -> parent , $ line ) ) ; return new CampfireLine ( $ this -> response ( $ line ) ) ; }
Get a single campfire line .
9,777
public function storeLine ( $ content ) { $ line = $ this -> client -> post ( sprintf ( 'buckets/%d/chats/%d/lines.json' , $ this -> bucket , $ this -> parent ) , [ 'json' => [ 'content' => $ content , ] , ] ) ; return new CampfireLine ( $ this -> response ( $ line ) ) ; }
Create a Campfire line .
9,778
public function show ( $ id ) { $ document = $ this -> client -> get ( sprintf ( 'buckets/%d/documents/%d.json' , $ this -> bucket , $ id ) ) ; return new Document ( $ this -> response ( $ document ) ) ; }
Get a document .
9,779
public function store ( $ data ) { $ document = $ this -> client -> post ( sprintf ( 'buckets/%d/vaults/%d/documents.json' , $ this -> bucket , $ this -> parent ) , [ 'json' => $ data , ] ) ; return new Document ( $ this -> response ( $ document ) ) ; }
Store a document .
9,780
public function update ( $ id , $ data ) { $ document = $ this -> client -> put ( sprintf ( 'buckets/%d/documents/%d.json' , $ this -> bucket , $ id ) , [ 'json' => $ data , ] ) ; return new Document ( $ this -> response ( $ document ) ) ; }
Update a document .
9,781
public function wrap ( string $ key , string $ kek ) : string { $ key_len = strlen ( $ key ) ; if ( $ key_len < 16 ) { throw new \ UnexpectedValueException ( "Key length must be at least 16 octets." ) ; } if ( 0 !== $ key_len % 8 ) { throw new \ UnexpectedValueException ( "Key length must be a multiple of 64 bits." ) ;...
Wrap a key using given key encryption key .
9,782
public function unwrap ( string $ ciphertext , string $ kek ) : string { if ( 0 !== strlen ( $ ciphertext ) % 8 ) { throw new \ UnexpectedValueException ( "Ciphertext length must be a multiple of 64 bits." ) ; } $ this -> _checkKEKSize ( $ kek ) ; $ C = str_split ( $ ciphertext , 8 ) ; list ( $ A , $ R ) = $ this -> _u...
Unwrap a key from a ciphertext using given key encryption key .
9,783
public function wrapPad ( string $ key , string $ kek ) : string { if ( ! strlen ( $ key ) ) { throw new \ UnexpectedValueException ( "Key must have at least one octet." ) ; } $ this -> _checkKEKSize ( $ kek ) ; list ( $ key , $ aiv ) = $ this -> _padKey ( $ key ) ; if ( 8 == strlen ( $ key ) ) { return $ this -> _encr...
Wrap a key of arbitrary length using given key encryption key .
9,784
public function unwrapPad ( string $ ciphertext , string $ kek ) : string { if ( 0 !== strlen ( $ ciphertext ) % 8 ) { throw new \ UnexpectedValueException ( "Ciphertext length must be a multiple of 64 bits." ) ; } $ this -> _checkKEKSize ( $ kek ) ; list ( $ P , $ A ) = $ this -> _unwrapPaddedCiphertext ( $ ciphertext...
Unwrap a key from a padded ciphertext using given key encryption key .
9,785
protected function _checkKEKSize ( string $ kek ) : self { $ len = $ this -> _keySize ( ) ; if ( strlen ( $ kek ) != $ len ) { throw new \ UnexpectedValueException ( "KEK size must be $len bytes." ) ; } return $ this ; }
Check KEK size .
9,786
protected function _wrapBlocks ( array $ P , string $ kek , string $ iv ) : array { $ n = count ( $ P ) ; $ A = $ iv ; $ R = $ P ; for ( $ j = 0 ; $ j <= 5 ; ++ $ j ) { for ( $ i = 1 ; $ i <= $ n ; ++ $ i ) { $ B = $ this -> _encrypt ( $ kek , $ A . $ R [ $ i ] ) ; $ t = $ n * $ j + $ i ; $ A = $ this -> _msb64 ( $ B )...
Apply Key Wrap to data blocks .
9,787
protected function _unwrapPaddedCiphertext ( string $ ciphertext , string $ kek ) : array { $ C = str_split ( $ ciphertext , 8 ) ; $ n = count ( $ C ) - 1 ; if ( $ n == 1 ) { $ P = str_split ( $ this -> _decrypt ( $ kek , $ C [ 0 ] . $ C [ 1 ] ) , 8 ) ; $ A = $ P [ 0 ] ; unset ( $ P [ 0 ] ) ; } else { list ( $ A , $ R ...
Unwrap the padded ciphertext producing plaintext and integrity value .
9,788
protected function _unwrapBlocks ( array $ C , string $ kek ) : array { $ n = count ( $ C ) - 1 ; if ( ! $ n ) { throw new \ UnexpectedValueException ( "No blocks." ) ; } $ A = $ C [ 0 ] ; $ R = $ C ; for ( $ j = 5 ; $ j >= 0 ; -- $ j ) { for ( $ i = $ n ; $ i >= 1 ; -- $ i ) { $ t = $ n * $ j + $ i ; $ B = $ this -> _...
Apply Key Unwrap to data blocks .
9,789
protected function _padKey ( string $ key ) : array { $ len = strlen ( $ key ) ; if ( 0 != $ len % 8 ) { $ key .= str_repeat ( "\0" , 8 - $ len % 8 ) ; } $ mli = pack ( "N" , $ len ) ; $ aiv = self :: AIV_HI . $ mli ; return [ $ key , $ aiv ] ; }
Pad a key with zeroes and compute alternative initial value .
9,790
protected function _verifyPadding ( array $ P , string $ A ) : int { $ mli = substr ( $ A , - 4 ) ; $ len = unpack ( "N1" , $ mli ) [ 1 ] ; $ n = count ( $ P ) ; if ( 8 * ( $ n - 1 ) >= $ len || $ len > 8 * $ n ) { throw new \ UnexpectedValueException ( "Invalid message length." ) ; } $ b = 8 - ( $ len % 8 ) ; if ( $ b...
Verify that the padding of the plaintext is valid .
9,791
public function get_label ( $ field ) { return isset ( $ this -> labels [ $ field ] ) ? $ this -> labels [ $ field ] : $ this -> humanize_field_name ( $ field ) ; }
Get field label
9,792
public function add_filter ( $ field , $ filter ) { if ( ! is_callable ( $ filter ) ) return $ this ; if ( ! isset ( $ this -> filters [ $ field ] ) ) $ this -> filters [ $ field ] = array ( ) ; $ this -> filters [ $ field ] [ ] = $ filter ; return $ this ; }
Add a Filter to this Field
9,793
public function add_rule ( $ field , $ rule ) { if ( ! $ rule instanceof \ HybridLogic \ Validation \ Rule ) return $ this ; if ( ! isset ( $ this -> labels [ $ field ] ) ) { $ this -> set_label ( $ field , $ this -> humanize_field_name ( $ field ) ) ; } if ( ! isset ( $ this -> rules [ $ field ] ) ) $ this -> rules [ ...
Add a Rule to this Field
9,794
public function is_valid ( array $ data ) { $ this -> data = $ this -> apply_filters ( $ data ) ; $ this -> errors = $ this -> test_rules ( ) ; return empty ( $ this -> errors ) ; }
Validate this object!
9,795
public function get_data ( $ field = null , $ default = null ) { if ( $ field === null ) return $ this -> data ; return array_key_exists ( $ field , $ this -> data ) ? $ this -> data [ $ field ] : $ default ; }
Return validated data
9,796
protected function apply_filters ( array $ data ) { if ( empty ( $ this -> filters ) ) return $ data ; foreach ( $ this -> filters as $ field => $ filters ) { if ( ! isset ( $ data [ $ field ] ) ) continue ; $ value = $ data [ $ field ] ; foreach ( $ filters as $ filter ) { $ value = call_user_func ( $ filter , $ value...
Apply any defined filters
9,797
public function lines ( $ nextPage = null ) { return Basecamp :: campfires ( $ this -> bucket -> id , $ this -> id ) -> lines ( $ nextPage ) ; }
Get a Campfire lines .
9,798
public function line ( $ id ) { return Basecamp :: campfires ( $ this -> bucket -> id , $ this -> id ) -> line ( $ id ) ; }
Get a single campfire lines .
9,799
public function storeLine ( $ content ) { return Basecamp :: campfires ( $ this -> bucket -> id , $ this -> id ) -> storeLine ( $ content ) ; }
Add a campfire line .