idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
45,800
public static function sendJSONSettings ( $ settings , $ settings_url , $ key_key , $ secret , & $ debug_log = false , $ signature = false ) { $ content_type = "application/vnd.ims.lti.v2.toolsettings.simple+json" ; if ( is_array ( $ debug_log ) ) $ debug_log [ ] = array ( 'Sending ' . count ( $ settings ) . ' settings...
Send setings data using the JSON protocol from IMS LTI 2 . x
45,801
public static function sendJSONBody ( $ method , $ postBody , $ content_type , $ rest_url , $ key_key , $ secret , & $ debug_log = false , $ signature = false ) { if ( is_array ( $ debug_log ) ) $ debug_log [ ] = array ( 'Sending ' . strlen ( $ postBody ) . ' bytes to rest_url=' . $ rest_url ) ; $ more_headers = false ...
Send a JSON body LTI 2 . x Style
45,802
public static function ltiLinkUrl ( $ postdata = false ) { if ( $ postdata === false ) $ postData = $ _POST ; if ( ! isset ( $ postdata [ 'content_item_return_url' ] ) ) return false ; if ( isset ( $ postdata [ 'accept_media_types' ] ) ) { $ ltilink_mimetype = 'application/vnd.ims.lti.v1.ltilink' ; $ m = new Mimeparse ...
ltiLinkUrl - Returns true if we can return LTI Links for this launch
45,803
public static function getLtiLinkJSON ( $ url , $ title = false , $ text = false , $ icon = false , $ fa_icon = false , $ custom = false ) { $ return = '{ "@context" : "http://purl.imsglobal.org/ctx/lti/v1/ContentItem", "@graph" : [ { "@type" : "LtiLinkItem", ...
getLtiLinkJson - Get a JSON object for an LTI Link Content Item Return
45,804
public static function validateUpload ( $ FILE_DESCRIPTOR , $ SAFETY_CHECK = true ) { $ retval = true ; $ filename = isset ( $ FILE_DESCRIPTOR [ 'name' ] ) ? basename ( $ FILE_DESCRIPTOR [ 'name' ] ) : false ; if ( $ FILE_DESCRIPTOR [ 'error' ] == 1 ) { $ retval = _m ( "General upload failure" ) ; } else if ( $ FILE_DE...
Returns true if this is a good upload an error string if not
45,805
public static function isPngOrJpeg ( $ FILE_DESCRIPTOR ) { if ( ! isset ( $ FILE_DESCRIPTOR [ 'name' ] ) ) return false ; if ( ! isset ( $ FILE_DESCRIPTOR [ 'tmp_name' ] ) ) return false ; $ info = getimagesize ( $ FILE_DESCRIPTOR [ 'tmp_name' ] ) ; if ( ! is_array ( $ info ) ) return false ; $ image_type = $ info [ 2 ...
Make sure the contents of this file are a PNG or JPEG
45,806
public static function uploadToBlob ( $ FILE_DESCRIPTOR , $ SAFETY_CHECK = true ) { $ retval = self :: uploadFileToBlob ( $ FILE_DESCRIPTOR , $ SAFETY_CHECK ) ; if ( is_array ( $ retval ) ) $ retval = $ retval [ 0 ] ; return $ retval ; }
uploadToBlob - returns blob_id or false
45,807
public static function migrate ( $ file_id , $ test_key = false ) { global $ CFG , $ PDOX ; $ retval = false ; if ( isset ( $ CFG -> dataroot ) && strlen ( $ CFG -> dataroot ) > 0 ) { if ( ! $ test_key ) { $ retval = self :: blob2file ( $ file_id ) ; } } else { $ retval = self :: blob2blob ( $ file_id ) ; } return $ re...
Check and migrate a blob from an old place to the right new place
45,808
public static function blob2file ( $ file_id ) { global $ CFG , $ PDOX ; if ( ! isset ( $ CFG -> dataroot ) || strlen ( $ CFG -> dataroot ) < 1 ) return ; $ stmt = $ PDOX -> prepare ( "SELECT file_sha256, blob_id FROM {$CFG->dbprefix}blob_file WHERE path IS NULL AND file_id = :ID" ) ; $ stmt -> ex...
Check and migrate a blob to its corresponding file
45,809
public static function pushCaliperEvents ( $ seconds = 3 , $ max = 100 , $ debug = false ) { $ purged = self :: purgeCaliperEvents ( ) ; $ start = time ( ) ; $ count = 0 ; $ now = $ start ; $ end = $ start + $ seconds ; $ failure = 0 ; $ failure_code = false ; $ retval = array ( ) ; if ( U :: apcAvailable ( ) ) { $ fou...
Send the backlog of caliper events but don t overrun
45,810
public static function purgeCaliperEvents ( ) { global $ CFG ; if ( U :: apcAvailable ( ) ) { $ push_found = false ; $ last_push = apc_fetch ( 'last_event_push_time' , $ push_found ) ; $ push_diff = time ( ) - $ last_push ; $ purge_found = false ; $ last_purge = apc_fetch ( 'last_event_purge_time' , $ purge_found ) ; $...
Periodic cleanup of broken Caliper events
45,811
protected function heartbeat ( ) : DisposableInterface { return $ this -> readBuffer -> timeout ( $ this -> heartBeatRate ) -> filter ( function ( SocketMessage $ message ) { return $ message -> getMessageType ( ) -> getType ( ) === MessageType :: HEARTBEAT_REQUEST_COMMAND ; } ) -> subscribe ( new CallbackObserver ( fu...
Intercept heartbeat message and answer automatically
45,812
public function catchUpSubscription ( string $ streamId , int $ startFrom = self :: POSITION_START , bool $ resolveLink = false ) : Observable { return $ this -> readEventsForward ( $ streamId , $ startFrom , self :: DEFAULT_MAX_EVENTS , $ resolveLink ) -> concat ( $ this -> volatileSubscription ( $ streamId , $ resolv...
This kind of subscription specifies a starting point in the form of an event number or transaction file position . The given function will be called for events from the starting point until the end of the stream and then for subsequently written events .
45,813
public function volatileSubscription ( string $ streamId , bool $ resolveLink = false ) : Observable { $ event = new SubscribeToStream ( ) ; $ event -> setEventStreamId ( $ streamId ) ; $ event -> setResolveLinkTos ( $ resolveLink ) ; return Observable :: create ( function ( ObserverInterface $ observer ) use ( $ event...
This kind of subscription calls a given function for events written after the subscription is established .
45,814
public function getAreasByName ( $ name ) { if ( ! isset ( $ this -> areas [ $ name ] ) ) { return null ; } return $ this -> areas [ $ name ] ; }
Gets an array of Areas with a specific name .
45,815
public static function createFromDecodedJsonResponse ( $ data ) { $ areas = [ ] ; foreach ( $ data as $ name => $ area ) { $ areas [ $ name ] = [ ] ; foreach ( $ area as $ class => $ data ) { $ metaClass = DynamicMetadataHelper :: getDynamicMetadataClassName ( $ class ) ; $ areas [ $ name ] [ ] = $ metaClass :: createF...
Create a DynamicMetadata from the decoded JSON data .
45,816
public static function loadLinkInfo ( $ link_id ) { global $ CFG , $ PDOX , $ CONTEXT ; $ cacheloc = 'lti_link' ; $ row = Cache :: check ( $ cacheloc , $ link_id ) ; if ( $ row != false ) return $ row ; $ stmt = $ PDOX -> queryDie ( "SELECT title FROM {$CFG->dbprefix}lti_link WHERE link_id = :LID AND con...
Load link information for a different link than current
45,817
public function getPlacementSecret ( ) { global $ CFG ; $ PDOX = $ this -> launch -> pdox ; $ stmt = $ PDOX -> queryDie ( "SELECT placementsecret FROM {$CFG->dbprefix}lti_link WHERE link_id = :LID" , array ( ':LID' => $ this -> id ) ) ; $ row = $ stmt -> fetch ( \ PDO :: FETCH_ASSOC ) ; $ placementsecret...
Get the placement secret for this Link
45,818
public function returnUrl ( ) { if ( ! isset ( $ this -> claim ) ) return false ; return isset ( $ this -> claim -> deep_link_return_url ) ? $ this -> claim -> deep_link_return_url : false ; }
returnUrl - Returns the deep_link_return_url
45,819
public function allowMimetype ( $ Mimetype ) { if ( ! $ this -> returnUrl ( ) ) return false ; if ( isset ( $ this -> claim -> accept_media_types ) ) { $ ma = $ Mimetype ; if ( ! is_array ( $ ma ) ) $ ma = array ( $ Mimetype ) ; $ m = new Mimeparse ; $ allowed = $ m -> best_match ( $ ma , $ this -> claim -> accept_medi...
allowMimetype - Returns true if we can return LTI Link Items
45,820
public function acceptType ( $ type ) { if ( ! isset ( $ this -> claim -> accept_types ) ) return false ; if ( ! is_array ( $ this -> claim -> accept_types ) ) return false ; return in_array ( $ type , $ this -> claim -> accept_types ) ; }
acceptType - Returns true if the string is in the accept_types
45,821
function getScriptFolder ( ) { $ path = self :: getScriptPathFull ( ) ; if ( $ path === false ) return false ; $ pieces = explode ( '/' , $ path ) ; if ( count ( $ pieces ) < 1 ) return false ; return $ pieces [ count ( $ pieces ) - 1 ] ; }
This function will return attend
45,822
function getPwd ( $ file ) { $ root = $ this -> dirroot ; $ path = realpath ( dirname ( $ file ) ) ; $ root .= '/' ; if ( strlen ( $ path ) < strlen ( $ root ) ) return false ; if ( strpos ( $ path , $ root ) !== 0 ) return false ; $ retval = substr ( $ path , strlen ( $ root ) ) ; return $ retval ; }
Get the current working directory of a file
45,823
public function getCurrentUrl ( ) { $ script = self :: getScriptName ( ) ; if ( $ script === false ) return false ; $ pieces = $ this -> apphome ; if ( $ this -> apphome ) { $ pieces = parse_url ( $ this -> apphome ) ; } if ( ! isset ( $ pieces [ 'scheme' ] ) ) return false ; $ retval = $ pieces [ 'scheme' ] . '://' . ...
Get the current URL we are executing - no query parameters
45,824
public function getCurrentUrlFolder ( ) { $ url = self :: getCurrentUrl ( ) ; $ pieces = explode ( '/' , $ url ) ; array_pop ( $ pieces ) ; $ retval = implode ( '/' , $ pieces ) ; return $ retval ; }
Get the current folder of the URL we are executing - no trailing slash
45,825
public function localhost ( ) { if ( strpos ( $ this -> wwwroot , '://localhost' ) !== false ) return true ; if ( strpos ( $ this -> wwwroot , '://127.0.0.1' ) !== false ) return true ; return false ; }
Are we on localhost?
45,826
public static function createFromDecodedJsonResponse ( $ data ) { if ( ! isset ( $ data [ 'user_metadata' ] ) ) { $ data [ 'user_metadata' ] = [ ] ; } else { foreach ( $ data [ 'user_metadata' ] as $ key => $ value ) { if ( 0 === strpos ( $ key , 'date:' ) ) { $ data [ 'user_metadata' ] [ $ key ] = new \ DateTime ( $ v...
Create a source image from the decoded JSON data .
45,827
public static function & clone_remote ( $ repo_path , $ remote , $ reference = null ) { return GitRepo :: create_new ( $ repo_path , $ remote , true , $ reference ) ; }
Clones a remote repo into a directory and then returns a GitRepo object for the newly created local repo
45,828
public static function buildSearchSortParameter ( array $ sorts ) { if ( empty ( $ sorts ) ) { return '' ; } $ sorting = [ ] ; foreach ( $ sorts as $ sortField => $ direction ) { if ( ! self :: validateFieldName ( ( string ) $ sortField ) ) { throw new \ LogicException ( sprintf ( 'Invalid field name "%s" for sorting f...
Builds the sort parameter for the source image listing API endpoint .
45,829
public static function isRequestDetail ( $ request_data = false ) { $ raw_jwt = self :: raw_jwt ( $ request_data ) ; if ( ! $ raw_jwt ) return false ; $ jwt = self :: parse_jwt ( $ raw_jwt ) ; if ( is_string ( $ jwt ) ) { return $ jwt ; } return is_object ( $ jwt ) ; }
Returns true false or a string
45,830
public static function isRequest ( $ request_data = false ) { $ retval = self :: isRequestDetail ( $ request_data ) ; if ( is_string ( $ retval ) ) { error_log ( "Bad launch " . $ retval ) ; return false ; } return is_object ( $ retval ) ; }
Returns true or false
45,831
public static function verifyPublicKey ( $ raw_jwt , $ public_key , $ algs ) { try { $ decoded = JWT :: decode ( $ raw_jwt , $ public_key , $ algs ) ; return true ; } catch ( \ Exception $ e ) { return $ e ; } }
Verify the Public Key for this request
45,832
public static function jonPostel ( $ body , & $ failures ) { if ( isset ( $ CFG -> jon_postel ) ) return ; $ version = false ; if ( isset ( $ body -> { self :: VERSION_CLAIM } ) ) $ version = $ body -> { self :: VERSION_CLAIM } ; if ( strpos ( $ version , '1.3' ) !== 0 ) $ failures [ ] = "Bad LTI version: " . $ version...
Apply Jon Postel s Law as appropriate
45,833
public static function loadRoster ( $ membership_url , $ access_token , & $ debug_log = false ) { $ ch = curl_init ( ) ; $ membership_url = trim ( $ membership_url ) ; $ headers = [ 'Authorization: Bearer ' . $ access_token , 'Accept: ' . self :: MEDIA_TYPE_MEMBERSHIPS , 'Content-Type: ' . self :: MEDIA_TYPE_MEMBERSHIP...
Call memberships and roles
45,834
public static function loadLineItem ( $ lineitem_url , $ access_token , & $ debug_log = false ) { $ lineitem_url = trim ( $ lineitem_url ) ; $ ch = curl_init ( ) ; $ headers = [ 'Authorization: Bearer ' . $ access_token , 'Accept: ' . self :: MEDIA_TYPE_LINEITEM , ] ; curl_setopt ( $ ch , CURLOPT_URL , $ lineitem_url )...
Load A LineItem
45,835
public static function loadResults ( $ lineitem_url , $ access_token , & $ debug_log = false ) { $ lineitem_url = trim ( $ lineitem_url ) ; $ ch = curl_init ( ) ; $ headers = [ 'Authorization: Bearer ' . $ access_token , 'Content-Type: ' . self :: RESULTS_TYPE , 'Accept: ' . self :: RESULTS_TYPE ] ; $ actual_url = $ li...
Load results for a LineItem
45,836
public static function deleteLineItem ( $ lineitem_url , $ access_token , & $ debug_log = false ) { $ lineitem_url = trim ( $ lineitem_url ) ; $ ch = curl_init ( ) ; $ headers = [ 'Authorization: Bearer ' . $ access_token ] ; curl_setopt ( $ ch , CURLOPT_URL , $ lineitem_url ) ; curl_setopt ( $ ch , CURLOPT_HTTPHEADER ...
Delete A LineItem
45,837
public static function getISO8601 ( $ timestamp = false ) { if ( $ timestamp === false ) { $ dt = new \ DateTime ( ) ; } else { $ format = 'Y-m-d H:i:s' ; $ dt = \ DateTime :: createFromFormat ( $ format , $ timestamp ) ; } $ iso8601 = $ dt -> format ( \ DateTime :: ISO8601 ) ; $ iso8601 = str_replace ( '-1000' , '.000...
Get Caliper - style ISO8601 Datetime from unix timestamp
45,838
public static function sensorCanvasPageView ( $ user , $ application , $ page , $ timestamp = false , $ name , $ duration = 'PT5M30S' ) { $ caliper = json_decode ( '{ "@context" : "http://purl.imsglobal.org/ctx/caliper/v1/ViewEvent", "@type" : "http://purl.imsglobal.org/caliper/v1/ViewEvent", ...
This is just a test method to return properly formatted JSON for the Canvas prototype Caliper
45,839
public function cleanup ( ) { if ( $ this -> option ( 'force' ) ) { $ this -> deleteDirs ( ) ; } elseif ( $ this -> confirm ( 'Delete all subdirectories in migrations folder?' , true ) ) { $ this -> deleteDirs ( ) ; } }
Decide whether or not to delete directories .
45,840
public function deleteDirs ( ) { $ dirs = $ this -> files -> directories ( $ this -> basePath ) ; foreach ( $ dirs as $ dir ) { $ this -> files -> deleteDirectory ( $ dir ) ; } $ this -> info ( 'Subdirectories deleted' ) ; }
Delete subdirectories in the migrations folder .
45,841
public static function createFromDecodedJsonResponse ( $ data ) { $ stack_operations = [ ] ; if ( isset ( $ data [ 'stack_operations' ] ) && \ is_array ( $ data [ 'stack_operations' ] ) ) { foreach ( $ data [ 'stack_operations' ] as $ operation ) { $ stack_operations [ ] = StackOperation :: createFromDecodedJsonRespons...
Create a stack from a decoded JSON data returned by the rokka . io API .
45,842
public static function createFromConfig ( $ stackName , array $ config , $ organization = null ) { $ stack = new static ( $ organization , $ stackName ) ; if ( isset ( $ config [ 'operations' ] ) ) { $ stack -> setStackOperations ( $ config [ 'operations' ] ) ; } if ( isset ( $ config [ 'options' ] ) ) { $ stack -> set...
Creates a Stack object from an array .
45,843
public function getDynamicUriString ( ) { $ stack = new StackUri ( 'dynamic' , $ this -> getStackOperations ( ) , $ this -> getStackOptions ( ) , $ this -> getStackVariables ( ) ) ; return $ stack -> getStackUriString ( ) ; }
Returns the stack url part as a dynamic stack for previewing .
45,844
public static function createFromJsonResponse ( $ data ) { $ data = json_decode ( $ data , true ) ; $ stacks = array_map ( function ( $ stack ) { return Stack :: createFromDecodedJsonResponse ( $ stack ) ; } , $ data [ 'items' ] ) ; return new self ( $ stacks ) ; }
Create a stack from the JSON data returned by the rokka . io API .
45,845
public function click ( $ time = null ) { $ this -> total ++ ; if ( ! $ this -> timestart ) { $ this -> timestart = ( int ) ( time ( ) / $ this -> scale ) ; } if ( ! $ time ) $ time = time ( ) ; $ time = ( int ) ( $ time / $ this -> scale ) ; $ delta = $ time - $ this -> timestart ; if ( $ delta < 0 ) $ delta = 0 ; if ...
Record a click ...
45,846
public function reconstruct ( ) { $ retval = array ( ) ; foreach ( $ this -> buckets as $ k => $ v ) { $ t = ( $ this -> timestart + $ k ) * $ this -> scale ; $ retval [ $ t ] = $ v ; } return $ retval ; }
Reconstruct to the actual times
45,847
public function viewModel ( ) { $ retval = new \ stdClass ( ) ; $ buckets = $ this -> reconstruct ( ) ; $ retval -> timestart = $ this -> timestart * $ this -> scale ; $ retval -> width = $ this -> scale ; $ max = false ; $ maxt = false ; $ min = false ; $ rows = array ( ) ; foreach ( $ buckets as $ k => $ v ) { if ( $...
Produce an view model of the entire object
45,848
public static function uncompressEntry ( $ text ) { if ( $ text === null | $ text === false ) return $ text ; $ needed = false ; for ( $ i = 0 ; $ i < strlen ( $ text ) ; $ i ++ ) { $ ch = $ text [ $ i ] ; if ( $ ch >= '0' && $ ch <= '9' ) continue ; if ( $ ch == ':' || $ ch == ',' || $ ch == '=' ) continue ; $ needed ...
Optionally uncompress a serialized entry if it is compressed
45,849
public function serialize ( $ maxlength = null , $ compress = false ) { if ( ! $ maxlength ) $ maxlength = $ this -> maxlen ; $ retval = $ this -> scale . ':' . $ this -> timestart . ':' . U :: array_Integer_Serialize ( $ this -> buckets ) ; if ( strlen ( $ retval ) <= $ maxlength ) return $ retval ; $ allowCompress = ...
Serialize to a key = value pair
45,850
function getLoginUrl ( $ state ) { $ loginUrl = "https://accounts.google.com/o/oauth2/auth?" . "client_id=" . $ this -> client_id . "&redirect_uri=" . $ this -> redirect . "&state=" . $ state . "&response_type=code" . "&scope=email%20profile" . "&include_granted_scopes=true" ; if ( $ this -> openid_realm ) { $ loginUrl...
Get the login url
45,851
public static function route_get_local_path ( $ dir ) { $ uri = $ _SERVER [ 'REQUEST_URI' ] ; $ root = $ _SERVER [ 'DOCUMENT_ROOT' ] ; $ cwd = $ dir ; if ( strlen ( $ cwd ) < strlen ( $ root ) + 1 ) return false ; $ lwd = substr ( $ cwd , strlen ( $ root ) ) ; if ( strlen ( $ uri ) < strlen ( $ lwd ) + 2 ) return false...
Convienence method to get the local path if we are doing
45,852
public static function get_request_document ( ) { $ uri = $ _SERVER [ 'REQUEST_URI' ] ; $ pieces = explode ( '/' , $ uri ) ; if ( count ( $ pieces ) > 1 ) { $ local_path = $ pieces [ count ( $ pieces ) - 1 ] ; $ pos = strpos ( $ local_path , '?' ) ; if ( $ pos > 0 ) $ local_path = substr ( $ local_path , 0 , $ pos ) ; ...
Get the last bit of the path
45,853
public static function get_base_url ( $ url ) { $ pieces = parse_url ( $ url ) ; $ retval = $ pieces [ 'scheme' ] . '://' . $ pieces [ 'host' ] ; $ port = self :: get ( $ pieces , 'port' ) ; if ( $ port && $ port != 80 && $ port != 443 ) $ retval .= ':' . $ port ; return $ retval ; }
Get the protocol host and port from an absolute URL
45,854
public static function parse_rest_path ( $ uri = false , $ SERVER_SCRIPT_NAME = false ) { if ( ! $ SERVER_SCRIPT_NAME ) $ SERVER_SCRIPT_NAME = $ _SERVER [ "SCRIPT_NAME" ] ; if ( ! $ uri ) $ uri = $ _SERVER [ 'REQUEST_URI' ] ; $ pos = strpos ( $ uri , '?' ) ; if ( $ pos !== false ) $ uri = substr ( $ uri , 0 , $ pos ) ;...
Get the controller for the current request
45,855
public static function rest_path ( $ uri = false , $ SERVER_SCRIPT_NAME = false ) { global $ CFG ; $ retval = self :: parse_rest_path ( $ uri , $ SERVER_SCRIPT_NAME ) ; if ( ! is_array ( $ retval ) ) return false ; $ retobj = new \ stdClass ( ) ; if ( $ retval [ 0 ] == '/' ) { $ retobj -> parent = '' ; } else { $ retob...
Return a rest - path
45,856
public static function remove_relative_path ( $ path ) { $ pieces = explode ( '/' , $ path ) ; $ new_pieces = array ( ) ; for ( $ i = 0 ; $ i < count ( $ pieces ) ; $ i ++ ) { if ( $ pieces [ $ i ] == '.' ) continue ; if ( $ pieces [ $ i ] == '..' ) { array_pop ( $ new_pieces ) ; continue ; } $ new_pieces [ ] = $ piece...
Remove any relative elements from a path
45,857
public static function http_response_code ( $ newcode = NULL ) { static $ code = 200 ; if ( $ newcode !== NULL ) { header ( 'X-PHP-Response-Code: ' . $ newcode , true , $ newcode ) ; if ( ! headers_sent ( ) ) $ code = $ newcode ; } return $ code ; }
For 4 . 3 . 0 < = PHP < = 5 . 4 . 0
45,858
public static function array_Integer_Deserialize ( $ input ) { $ r = array ( ) ; preg_match_all ( "/([^,= ]+)=([^,= ]+)/" , $ input , $ r ) ; $ result = array ( ) ; for ( $ i = 0 ; $ i < count ( $ r [ 1 ] ) ; $ i ++ ) { $ k = $ r [ 1 ] [ $ i ] ; $ v = $ r [ 2 ] [ $ i ] ; if ( ! is_numeric ( $ k ) || ! is_numeric ( $ v ...
Deserialize an tightly serialized integer - only PHP array
45,859
public static function getCaller ( $ count = 1 ) { $ dbts = debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS , 6 + $ count ) ; if ( ! is_array ( $ dbts ) || count ( $ dbts ) < 2 ) return null ; if ( ! isset ( $ dbts [ 0 ] [ 'file' ] ) ) return null ; $ myfile = $ dbts [ 0 ] [ 'file' ] ; $ retval = '' ; foreach ( $ dbts as...
Need to replicate the code or U . php will be in the traceback
45,860
private function annotationCrawl ( array $ annotations , LinkType $ link , ResourceObject $ current ) : ResourceObject { $ isList = $ this -> isList ( $ current -> body ) ; $ bodyList = $ isList ? ( array ) $ current -> body : [ $ current -> body ] ; foreach ( $ bodyList as & $ body ) { $ this -> crawl ( $ annotations ...
Link annotation crawl
45,861
public function getStackOperationsByName ( $ name ) { $ stackOperations = [ ] ; foreach ( $ this -> stackOperations as $ stackOperation ) { if ( $ stackOperation -> name === $ name ) { $ stackOperations [ ] = $ stackOperation ; } } return $ stackOperations ; }
Returns all operations matching name .
45,862
public static function get_headers ( ) { $ headers = OAuthUtil :: get_headers_internal ( ) ; if ( ! is_array ( $ headers ) ) return $ headers ; if ( ( ! isset ( $ headers [ 'Authorization' ] ) ) && isset ( $ headers [ 'X-Oauth1-Authorization' ] ) ) { $ headers [ 'Authorization' ] = $ headers [ 'X-Oauth1-Authorization' ...
header on our behalf - fall back to the alternate Authorization header .
45,863
public static function createFromArray ( $ config ) { if ( ! isset ( $ config [ 'stack' ] ) ) { throw new \ RuntimeException ( 'Stack has to be set' ) ; } $ hash = isset ( $ config [ 'hash' ] ) ? $ config [ 'hash' ] : null ; $ format = isset ( $ config [ 'format' ] ) ? $ config [ 'format' ] : null ; $ filename = isset ...
Creates a UriComponent object from an array with stack hash format filename and stack as keys .
45,864
protected function isPackageSupported ( $ package ) { $ extra = $ package -> getExtra ( ) ; if ( ! empty ( $ extra [ 'drupal' ] [ 'security-coverage' ] [ 'status' ] ) && $ extra [ 'drupal' ] [ 'security-coverage' ] [ 'status' ] == 'not-covered' ) { return false ; } return true ; }
Checks to see if this Drupal package is supported by the Drupal Security Team .
45,865
public function onPostCmdEvent ( \ Composer \ Script \ Event $ event ) { if ( ! empty ( $ this -> unsupportedPackages ) ) { $ this -> io -> write ( '<error>You are using Drupal packages that are not supported by the Drupal Security Team!</error>' ) ; foreach ( $ this -> unsupportedPackages as $ package_name => $ packag...
Execute blt update after update command has been executed if applicable .
45,866
protected function getDrupalPackage ( $ operation ) { if ( $ operation instanceof InstallOperation ) { $ package = $ operation -> getPackage ( ) ; } elseif ( $ operation instanceof UpdateOperation ) { $ package = $ operation -> getTargetPackage ( ) ; } if ( $ this -> isDrupalPackage ( $ package ) ) { return $ package ;...
Gets the package if it is a Drupal related package .
45,867
protected function isDrupalPackage ( $ package ) { if ( isset ( $ package ) && $ package instanceof PackageInterface && strstr ( $ package -> getName ( ) , 'drupal/' ) ) { return true ; } return false ; }
Checks to see if a given package is a Drupal package .
45,868
public function indexBy ( $ column ) { if ( ! $ this -> asArray ) { return parent :: indexBy ( $ column ) ; } $ modelClass = $ this -> modelClass ; $ this -> indexBy = function ( $ row ) use ( $ column , $ modelClass ) { if ( isset ( $ row [ $ column ] ) ) { return $ row [ $ column ] ; } $ dynamicColumn = $ modelClass ...
Converts the indexBy column name an anonymous function that writes rows to the result array indexed an attribute name that may be in dotted notation .
45,869
public function prepare ( $ builder ) { $ modelClass = $ this -> modelClass ; $ this -> _dynamicColumn = $ modelClass :: dynamicColumn ( ) ; if ( empty ( $ this -> _dynamicColumn ) ) { throw new \ yii \ base \ InvalidConfigException ( $ modelClass . '::dynamicColumn() must return an attribute name' ) ; } if ( empty ( $...
Maria - specific preparation for building a query that includes a dynamic column .
45,870
public function createCommand ( $ db = null ) { $ modelClass = $ this -> modelClass ; if ( $ db === null ) { $ db = $ modelClass :: getDb ( ) ; } if ( $ this -> sql === null ) { list ( $ sql , $ params ) = $ db -> getQueryBuilder ( ) -> build ( $ this ) ; } else { $ sql = $ this -> sql ; $ params = $ this -> params ; }...
Generate DB command from ActiveQuery with Maria - specific SQL for dynamic columns .
45,871
protected function getDotNotatedValue ( $ array , $ attribute ) { $ pieces = explode ( '.' , $ attribute ) ; foreach ( $ pieces as $ piece ) { if ( ! is_array ( $ array ) || ! array_key_exists ( $ piece , $ array ) ) { return null ; } $ array = $ array [ $ piece ] ; } return $ array ; }
Returns the value of the element in an array refereced by a dot - notated attribute name .
45,872
public function getAttribute ( $ name ) { try { return parent :: __get ( $ name ) ; } catch ( UnknownPropertyException $ ignore ) { } $ path = explode ( '.' , $ name ) ; $ ref = & $ this -> _dynamicAttributes ; foreach ( $ path as $ key ) { if ( ! isset ( $ ref [ $ key ] ) ) { return null ; } $ ref = & $ ref [ $ key ] ...
Returns a model attribute value .
45,873
public function setAttribute ( $ name , $ value ) { try { parent :: __set ( $ name , $ value ) ; return ; } catch ( UnknownPropertyException $ ignore ) { } $ path = explode ( '.' , $ name ) ; $ ref = & $ this -> _dynamicAttributes ; do { $ key = $ path [ 0 ] ; if ( isset ( $ ref [ $ key ] ) ) { $ ref = & $ ref [ $ key ...
Sets a model attribute .
45,874
public function issetAttribute ( $ name ) { try { if ( parent :: __get ( $ name ) !== null ) { return true ; } } catch ( Exception $ ignore ) { } $ path = explode ( '.' , $ name ) ; $ ref = & $ this -> _dynamicAttributes ; foreach ( $ path as $ key ) { if ( ! isset ( $ ref [ $ key ] ) ) { return false ; } $ ref = & $ r...
Returns if a model attribute is set .
45,875
public function unsetAttribute ( $ name ) { try { parent :: __unset ( $ name ) ; } catch ( \ Exception $ ignore ) { } if ( $ this -> issetAttribute ( $ name ) ) { $ this -> setAttribute ( $ name , null ) ; } }
Unset a model attribute .
45,876
protected static function dotKeyValues ( $ prefix , $ array ) { $ fields = [ ] ; foreach ( $ array as $ key => $ value ) { if ( is_string ( $ key ) ) { $ newPos = $ prefix . '.' . $ key ; if ( is_array ( $ value ) ) { $ fields = array_merge ( $ fields , static :: dotKeyValues ( $ newPos , $ value ) ) ; } else { $ field...
Convert a nested array to a map of dot - notation keys to values .
45,877
public function dotAttributeNames ( ) { return array_merge ( array_values ( parent :: fields ( ) ) , array_keys ( static :: dotKeyValues ( static :: dynamicColumn ( ) , $ this -> _dynamicAttributes ) ) ) ; }
Return a list of all model attribute names recursing structured dynamic attributes .
45,878
public static function columnExpression ( $ name , $ type = 'char' ) { $ sql = '[[' . static :: dynamicColumn ( ) . ']]' ; $ parts = explode ( '.' , $ name ) ; $ lastPart = array_pop ( $ parts ) ; foreach ( $ parts as $ column ) { $ sql = "COLUMN_GET($sql, '$column' AS BINARY)" ; } $ sql = "COLUMN_GET($sql, '$lastPart'...
Generate an SQL expression referring to the given dynamic column .
45,879
public static function encodeForMaria ( $ value ) { return is_string ( $ value ) && ( ! mb_check_encoding ( $ value , 'UTF-8' ) || strpos ( $ value , self :: DATA_URI_PREFIX ) === 0 ) ? self :: DATA_URI_PREFIX . base64_encode ( $ value ) : $ value ; }
Encode as data URIs strings that JSON cannot express .
45,880
public static function decodeForMaria ( $ value ) { return is_string ( $ value ) && strpos ( $ value , self :: DATA_URI_PREFIX ) === 0 ? file_get_contents ( $ value ) : $ value ; }
Decode strings encoded as data URIs .
45,881
protected static function walk ( & $ array , $ method ) { if ( is_scalar ( $ array ) ) { $ array = static :: $ method ( $ array ) ; return ; } $ replacements = [ ] ; foreach ( $ array as $ key => & $ value ) { if ( is_scalar ( $ value ) || $ value === null ) { $ value = static :: $ method ( $ value ) ; } else { static ...
Replacement for PHP s array walk and map builtins .
45,882
protected static function dynColSqlMaria ( array $ attrs , & $ params ) { $ sql = [ ] ; foreach ( $ attrs as $ key => $ value ) { if ( is_object ( $ value ) && ! ( $ value instanceof ValueExpression ) ) { $ value = method_exists ( $ value , 'toArray' ) ? $ value -> toArray ( ) : ( array ) $ value ; } if ( $ value === [...
Creates the SQL and parameter bindings for setting dynamic attributes in a DB record as Dynamic Columns in Maria .
45,883
public static function dynColExpression ( $ attrs ) { if ( ! $ attrs ) { return null ; } $ params = [ ] ; static :: encodeArrayForMaria ( $ attrs ) ; $ sql = static :: dynColSqlMaria ( $ attrs , $ params ) ; return new \ yii \ db \ Expression ( $ sql , $ params ) ; }
Creates a dynamic column SQL expression representing the given attributes .
45,884
public static function dynColDecode ( $ encoded ) { $ encoded = preg_replace_callback ( '/[\x00-\x1f]/' , function ( $ matches ) { return sprintf ( '\u00%02x' , ord ( $ matches [ 0 ] ) ) ; } , $ encoded ) ; $ decoded = json_decode ( $ encoded , true ) ; if ( $ decoded ) { static :: decodeArrayForMaria ( $ decoded ) ; }...
Decode a serialized blob of dynamic attributes .
45,885
public function beforeControllerAction ( $ controller , $ action ) { if ( parent :: beforeControllerAction ( $ controller , $ action ) ) { $ user = Yii :: app ( ) -> getUser ( ) ; if ( $ user instanceof AuthWebUser ) { if ( $ user -> isAdmin ) { return true ; } elseif ( $ user -> isGuest ) { $ user -> loginRequired ( )...
The pre - filter for controller actions .
45,886
public function getInputType ( ) { switch ( true ) { case $ this -> callback instanceof Closure : return self :: CLOSURE_TYPE ; case is_callable ( $ this -> callback , false ) : return self :: CALLABLE_TYPE ; case is_string ( $ this -> callback ) : return self :: SELF_METHOD_TYPE ; } throw new InvalidCallbackException ...
Figures out which type of input was provided
45,887
public function applyFilterRules ( $ property , $ filterRules = array ( ) ) { foreach ( $ filterRules as $ rule ) { $ this -> applyFilterRule ( $ property , $ rule ) ; } }
Applies the selected rules to a property in the object
45,888
private function setPropertyValue ( $ propertyName , $ value ) { $ this -> getAccessibleReflectionProperty ( $ propertyName ) -> setValue ( $ this -> object , $ value ) ; }
Overrides the value of a property overcoming visibility problems
45,889
private function getAccessibleReflectionProperty ( $ propertyName ) { $ property = $ this -> reflClass -> getProperty ( $ propertyName ) ; $ property -> setAccessible ( true ) ; return $ property ; }
Retrieves a property from the object and makes it visible
45,890
public function init ( ) { parent :: init ( ) ; $ this -> layout = $ this -> module -> defaultLayout ; $ this -> menu = $ this -> getSubMenu ( ) ; }
Initializes the controller .
45,891
public function getItemTypeText ( $ type , $ plural = false ) { $ n = $ plural ? 2 : 1 ; switch ( $ type ) { case CAuthItem :: TYPE_OPERATION : $ name = Yii :: t ( 'AuthModule.main' , 'operation|operations' , $ n ) ; break ; case CAuthItem :: TYPE_TASK : $ name = Yii :: t ( 'AuthModule.main' , 'task|tasks' , $ n ) ; br...
Returns the authorization item type as a string .
45,892
public function getItemControllerId ( $ type ) { $ controllerId = null ; switch ( $ type ) { case CAuthItem :: TYPE_OPERATION : $ controllerId = 'operation' ; break ; case CAuthItem :: TYPE_TASK : $ controllerId = 'task' ; break ; case CAuthItem :: TYPE_ROLE : $ controllerId = 'role' ; break ; default : throw new CExce...
Returns the controllerId for the given authorization item .
45,893
public function capitalize ( $ string ) { if ( ! extension_loaded ( 'mbstring' ) ) { return ucfirst ( $ string ) ; } $ encoding = Yii :: app ( ) -> charset ; $ firstChar = mb_strtoupper ( mb_substr ( $ string , 0 , 1 , $ encoding ) , $ encoding ) ; return $ firstChar . mb_substr ( $ string , 1 , mb_strlen ( $ string , ...
Capitalizes the first word in the given string .
45,894
protected function getSubMenu ( ) { return array ( array ( 'label' => Yii :: t ( 'AuthModule.main' , 'Assignments' ) , 'url' => array ( '/auth/assignment/index' ) , 'active' => $ this instanceof AssignmentController , ) , array ( 'label' => $ this -> capitalize ( $ this -> getItemTypeText ( CAuthItem :: TYPE_ROLE , tru...
Returns the sub menu configuration .
45,895
protected function setDefaults ( ) { parent :: setDefaults ( ) ; $ this -> setReferenceNumberLeftAttr ( 3 , 60 , 50 , 4 , null , null , 8 ) ; $ this -> setReferenceNumberRightAttr ( 125 , 33.5 , 80 , 4 ) ; $ this -> setCodeLineAttr ( 64 , 85 , 140 , 4 , null , 'OCRB10' ) ; $ this -> setSlipBackground ( __DIR__ . '/Reso...
Sets the default attributes of the elements for an orange slip
45,896
public function setReferenceNumberLeftAttr ( $ posX = null , $ posY = null , $ width = null , $ height = null , $ background = null , $ fontFamily = null , $ fontSize = null , $ fontColor = null , $ lineHeight = null , $ textAlign = null ) { $ this -> setAttributes ( $ this -> referenceNumberLeftAttr , $ posX , $ posY ...
Set the left reference number attributes
45,897
public function setReferenceNumberRightAttr ( $ posX = null , $ posY = null , $ width = null , $ height = null , $ background = null , $ fontFamily = null , $ fontSize = null , $ fontColor = null , $ lineHeight = null , $ textAlign = null ) { if ( $ textAlign === null ) { $ textAlign = 'R' ; } $ this -> setAttributes (...
Set the right reference number attributes
45,898
public function setCodeLineAttr ( $ posX = null , $ posY = null , $ width = null , $ height = null , $ background = null , $ fontFamily = null , $ fontSize = null , $ fontColor = null , $ lineHeight = null , $ textAlign = null ) { if ( $ textAlign === null ) { $ textAlign = 'R' ; } $ this -> setAttributes ( $ this -> c...
Set the code line attributes
45,899
public function setDisplayReferenceNr ( $ displayReferenceNr = true ) { $ this -> isBool ( $ displayReferenceNr , 'displayReferenceNr' ) ; $ this -> displayReferenceNr = $ displayReferenceNr ; return $ this ; }
Set whether or not to display the reference number