idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
28,100 | public function get_link ( $ reference ) { $ unpacked = $ this -> unpack_reference ( $ reference ) ; return $ this -> get_file_download_link ( $ unpacked -> url ) ; } | Return file URL for external link . |
28,101 | public function get_file ( $ reference , $ saveas = '' ) { $ unpacked = $ this -> unpack_reference ( $ reference ) ; $ downloadlink = $ this -> get_file_download_link ( $ unpacked -> url ) ; $ saveas = $ this -> prepare_file ( $ saveas ) ; file_put_contents ( $ saveas , fopen ( $ downloadlink , 'r' ) ) ; return [ 'path... | Downloads a file from external repository and saves it in temp dir . |
28,102 | public function get_listing ( $ path = '' , $ page = '1' ) { if ( empty ( $ path ) || $ path == '/' ) { $ path = '' ; } else { $ path = file_correct_filepath ( $ path ) ; } $ list = [ 'list' => [ ] , 'manage' => 'https://www.dropbox.com/home' , 'logouturl' => 'https://www.dropbox.com/logout' , 'message' => get_string (... | Get dropbox files . |
28,103 | public function search ( $ query , $ page = 0 ) { $ list = [ 'list' => [ ] , 'manage' => 'https://www.dropbox.com/home' , 'logouturl' => 'https://www.dropbox.com/logout' , 'message' => get_string ( 'logoutdesc' , 'repository_dropbox' ) , 'dynload' => true , ] ; try { $ result = $ this -> dropbox -> search ( $ query ) ;... | Get dropbox files in the specified path . |
28,104 | public function send_thumbnail ( $ source ) { $ content = $ this -> dropbox -> get_thumbnail ( $ source ) ; send_file ( $ content , basename ( $ source ) , 30 * DAYSECS , 0 , true ) ; } | Displays a thumbnail for current user s dropbox file . |
28,105 | protected function fix_old_style_reference ( $ packed ) { $ ref = unserialize ( $ packed ) ; $ ref = $ this -> dropbox -> get_file_share_info ( $ ref -> path ) ; if ( ! $ ref || empty ( $ ref -> url ) ) { return $ packed ; } $ newreference = serialize ( $ ref ) ; if ( $ newreference !== $ packed ) { global $ DB ; $ par... | Fixes references in DB that contains user credentials . |
28,106 | protected function unpack_reference ( $ packed ) { $ reference = unserialize ( $ packed ) ; if ( empty ( $ reference -> url ) ) { return unserialize ( $ this -> fix_old_style_reference ( $ packed ) ) ; } return $ reference ; } | Unpack the supplied serialized reference fixing it if required . |
28,107 | public function print_login ( ) { $ url = $ this -> dropbox -> get_login_url ( ) ; if ( $ this -> options [ 'ajax' ] ) { $ ret = array ( ) ; $ btn = new \ stdClass ( ) ; $ btn -> type = 'popup' ; $ btn -> url = $ url -> out ( false ) ; $ ret [ 'login' ] = array ( $ btn ) ; return $ ret ; } else { echo html_writer :: li... | Generate dropbox login url . |
28,108 | public function cron ( ) { $ fs = get_file_storage ( ) ; $ files = $ fs -> get_external_files ( $ this -> id ) ; $ fetchedreferences = [ ] ; foreach ( $ files as $ file ) { if ( isset ( $ fetchedreferences [ $ file -> get_referencefileid ( ) ] ) ) { continue ; } try { $ this -> import_external_file_contents ( $ file , ... | Caches all references to Dropbox files in moodle filepool . |
28,109 | public static function type_config_form ( $ mform , $ classname = 'repository' ) { parent :: type_config_form ( $ mform ) ; $ key = get_config ( 'dropbox' , 'dropbox_key' ) ; $ secret = get_config ( 'dropbox' , 'dropbox_secret' ) ; if ( empty ( $ key ) ) { $ key = '' ; } if ( empty ( $ secret ) ) { $ secret = '' ; } $ ... | Add Plugin settings input to Moodle form . |
28,110 | public function get_option ( $ config = '' ) { if ( $ config === 'dropbox_key' ) { return trim ( get_config ( 'dropbox' , 'dropbox_key' ) ) ; } else if ( $ config === 'dropbox_secret' ) { return trim ( get_config ( 'dropbox' , 'dropbox_secret' ) ) ; } else if ( $ config === 'dropbox_cachelimit' ) { return $ this -> max... | Get dropbox options |
28,111 | protected function process_entries ( array $ entries ) { global $ OUTPUT ; $ dirslist = [ ] ; $ fileslist = [ ] ; foreach ( $ entries as $ entry ) { $ entrydata = $ entry ; if ( isset ( $ entrydata -> metadata ) ) { $ entrydata = $ entrydata -> metadata ; } if ( $ entrydata -> { ".tag" } === "folder" ) { $ dirslist [ ]... | Process a standard entries list . |
28,112 | protected function process_breadcrumbs ( $ path ) { $ breadcrumbs = [ [ 'path' => '/' , 'name' => get_string ( 'dropbox' , 'repository_dropbox' ) , ] , ] ; $ path = rtrim ( $ path , '/' ) ; $ directories = explode ( '/' , $ path ) ; $ pathtodate = '' ; foreach ( $ directories as $ directory ) { if ( $ directory === '' ... | Process the breadcrumbs for a listing . |
28,113 | protected function get_thumbnail_url ( $ entry ) { if ( $ this -> dropbox -> supports_thumbnail ( $ entry ) ) { $ thumburl = new moodle_url ( '/repository/dropbox/thumbnail.php' , [ 'source' => $ entry -> id , 'path' => $ entry -> path_lower , 'repo_id' => $ this -> id , 'ctx_id' => $ this -> context -> id , ] ) ; retu... | Grab the thumbnail URL for the specified entry . |
28,114 | public function max_cache_bytes ( ) { if ( $ this -> cachelimit === null ) { $ this -> cachelimit = ( int ) get_config ( 'dropbox' , 'dropbox_cachelimit' ) ; } return $ this -> cachelimit ; } | Returns the maximum size of the Dropbox files to cache in moodle . |
28,115 | function generateChallenge ( $ varname = 'challenge' , $ size = 8 ) { $ this -> $ varname = '' ; for ( $ i = 0 ; $ i < $ size ; $ i ++ ) { $ this -> $ varname .= pack ( 'C' , 1 + mt_rand ( ) % 255 ) ; } return $ this -> $ varname ; } | Generates a random binary challenge |
28,116 | function ntPasswordHash ( $ password = null ) { if ( isset ( $ password ) ) { return pack ( 'H*' , hash ( 'md4' , $ this -> str2unicode ( $ password ) ) ) ; } else { return pack ( 'H*' , hash ( 'md4' , $ this -> str2unicode ( $ this -> password ) ) ) ; } } | Generates the NT - HASH from the given plaintext password . |
28,117 | function _challengeResponse ( $ lm = false ) { if ( $ lm ) { $ hash = $ this -> lmPasswordHash ( ) ; } else { $ hash = $ this -> ntPasswordHash ( ) ; } while ( strlen ( $ hash ) < 21 ) { $ hash .= "\0" ; } $ td = mcrypt_module_open ( MCRYPT_DES , '' , MCRYPT_MODE_ECB , '' ) ; $ iv = mcrypt_create_iv ( mcrypt_enc_get_iv... | Generates the response . |
28,118 | function _desHash ( $ plain ) { $ key = $ this -> _desAddParity ( $ plain ) ; $ td = mcrypt_module_open ( MCRYPT_DES , '' , MCRYPT_MODE_ECB , '' ) ; $ iv = mcrypt_create_iv ( mcrypt_enc_get_iv_size ( $ td ) , MCRYPT_RAND ) ; mcrypt_generic_init ( $ td , $ key , $ iv ) ; $ hash = mcrypt_generic ( $ td , 'KGS!@#$%' ) ; m... | Generates an irreversible HASH . |
28,119 | public function section_title_without_link ( $ section , $ course ) { return $ this -> render ( course_get_format ( $ course ) -> inplace_editable_render_section_name ( $ section , false ) ) ; } | Generate the section title to be displayed on the section page without a link |
28,120 | public static function get_name ( $ categoryid ) { global $ PAGE ; if ( $ categoryid === false || $ categoryid == context_instance :: INHERIT ) { return get_string ( 'inherit' , 'tool_dataprivacy' ) ; } else if ( $ categoryid == context_instance :: NOTSET ) { return get_string ( 'notset' , 'tool_dataprivacy' ) ; } else... | Utility function that fetches a category name from the given ID . |
28,121 | public function processModule ( $ module ) { if ( ! isset ( $ this -> registeredModules [ $ module ] ) || is_object ( $ module ) ) { $ this -> registerModule ( $ module ) ; } $ this -> modules [ $ module ] = $ this -> registeredModules [ $ module ] ; } | Takes a module and adds it to the active module collection registering it if necessary . |
28,122 | public static function invoke_move_action_parameters ( ) { return new external_function_parameters ( [ 'action' => new external_value ( PARAM_ALPHAEXT , 'Action' ) , 'dir' => new external_value ( PARAM_PATH , 'Plugin that is being edited' ) , 'table' => new external_value ( PARAM_NOTAGS , 'Table name' ) , 'field' => ne... | Parameters for the tool_xmldb_invoke_move_action WS |
28,123 | public static function invoke_move_action ( $ action , $ dir , $ table , $ field , $ key , $ index , $ position ) { global $ CFG , $ XMLDB , $ SESSION ; require_once ( $ CFG -> libdir . '/ddllib.php' ) ; require_once ( "$CFG->dirroot/$CFG->admin/tool/xmldb/actions/XMLDBAction.class.php" ) ; require_once ( "$CFG->dirroo... | WS tool_xmldb_invoke_move_action that invokes a move action |
28,124 | public function encode ( $ input ) { $ parts = explode ( '.' , $ input ) ; foreach ( $ parts as & $ part ) { $ part = $ this -> _encodePart ( $ part ) ; } return implode ( '.' , $ parts ) ; } | Encode a domain to its Punycode version . |
28,125 | protected function _encodePart ( $ input ) { $ codePoints = $ this -> _codePoints ( $ input ) ; $ n = static :: INITIAL_N ; $ bias = static :: INITIAL_BIAS ; $ delta = 0 ; $ h = $ b = count ( $ codePoints [ 'basic' ] ) ; $ output = '' ; foreach ( $ codePoints [ 'basic' ] as $ code ) { $ output .= $ this -> _codePointTo... | Encode a part of a domain name such as tld to its Punycode version . |
28,126 | public function decode ( $ input ) { $ parts = explode ( '.' , $ input ) ; foreach ( $ parts as & $ part ) { if ( strpos ( $ part , static :: PREFIX ) === 0 ) { $ part = $ this -> _decodePart ( substr ( $ part , strlen ( static :: PREFIX ) ) ) ; } } return implode ( '.' , $ parts ) ; } | Decode a Punycode domain name to its Unicode counterpart . |
28,127 | protected function _decodePart ( $ input ) { $ n = static :: INITIAL_N ; $ i = 0 ; $ bias = static :: INITIAL_BIAS ; $ output = '' ; $ pos = strrpos ( $ input , static :: DELIMITER ) ; if ( $ pos !== false ) { $ output = substr ( $ input , 0 , $ pos ++ ) ; } else { $ pos = 0 ; } $ outputLength = strlen ( $ output ) ; $... | Decode a part of domain name such as tld . |
28,128 | protected function _calculateThreshold ( $ k , $ bias ) { if ( $ k <= ( $ bias + static :: TMIN ) ) { return static :: TMIN ; } elseif ( $ k >= ( $ bias + static :: TMAX ) ) { return static :: TMAX ; } return $ k - $ bias ; } | Calculate the bias threshold to fall between TMIN and TMAX . |
28,129 | protected function _codePoints ( $ input ) { $ codePoints = array ( 'all' => array ( ) , 'basic' => array ( ) , 'nonBasic' => array ( ) ) ; $ len = Horde_String :: length ( $ input , 'UTF-8' ) ; for ( $ i = 0 ; $ i < $ len ; ++ $ i ) { $ char = Horde_String :: substr ( $ input , $ i , 1 , 'UTF-8' ) ; $ code = $ this ->... | List code points for a given input . |
28,130 | protected function _charToCodePoint ( $ char ) { $ code = ord ( $ char [ 0 ] ) ; if ( $ code < 128 ) { return $ code ; } elseif ( $ code < 224 ) { return ( ( $ code - 192 ) * 64 ) + ( ord ( $ char [ 1 ] ) - 128 ) ; } elseif ( $ code < 240 ) { return ( ( $ code - 224 ) * 4096 ) + ( ( ord ( $ char [ 1 ] ) - 128 ) * 64 ) ... | Convert a single or multi - byte character to its code point . |
28,131 | public function init ( $ selfitemisempty = false ) { global $ DB ; $ roleids = explode ( ',' , get_config ( 'moodle' , 'gradebookroles' ) ) ; $ this -> items = array ( ) ; foreach ( $ roleids as $ roleid ) { $ this -> items = $ this -> items + get_role_users ( $ roleid , $ this -> context , false , '' , 'u.id, u.lastna... | Initialise this screen |
28,132 | public function html ( ) { global $ OUTPUT ; $ html = '' ; $ types = gradereport_singleview :: valid_screens ( ) ; foreach ( $ types as $ type ) { $ classname = "gradereport_singleview\\local\\screen\\${type}" ; $ screen = new $ classname ( $ this -> courseid , null , $ this -> groupid ) ; if ( ! $ screen instanceof se... | Return the HTML for the page . |
28,133 | public static function list_templates ( $ component , $ search , $ themename = '' ) { $ params = self :: validate_parameters ( self :: list_templates_parameters ( ) , array ( 'component' => $ component , 'search' => $ search , 'themename' => $ themename , ) ) ; return api :: list_templates ( $ component , $ search , $ ... | Loads the list of templates . |
28,134 | public static function get_labels_by_courses ( $ courseids = array ( ) ) { $ warnings = array ( ) ; $ returnedlabels = array ( ) ; $ params = array ( 'courseids' => $ courseids , ) ; $ params = self :: validate_parameters ( self :: get_labels_by_courses_parameters ( ) , $ params ) ; $ mycourses = array ( ) ; if ( empty... | Returns a list of labels in a provided list of courses . If no list is provided all labels that the user can view will be returned . |
28,135 | protected static function send_conversation_message_to_processors ( array $ eventprocmaps , message $ eventdata , \ stdClass $ savemessage ) { global $ DB ; if ( $ DB -> is_transaction_started ( ) ) { self :: $ convmessagebuffer [ ] = [ $ eventprocmaps , $ eventdata , $ savemessage ] ; return ; } foreach ( $ eventprocm... | Takes a list of localised event data and tries to send them to their respective member s message processors . |
28,136 | public static function send_message ( message $ eventdata , \ stdClass $ savemessage , array $ processorlist ) { global $ CFG ; require_once ( $ CFG -> dirroot . '/message/lib.php' ) ; if ( empty ( $ processorlist ) ) { self :: trigger_message_events ( $ eventdata , $ savemessage ) ; if ( $ eventdata -> notification or... | Do the message sending . |
28,137 | protected static function send_message_to_processors ( $ eventdata , \ stdClass $ savemessage , array $ processorlist ) { global $ CFG , $ DB ; if ( $ DB -> is_transaction_started ( ) ) { $ eventdata = clone ( $ eventdata ) ; $ eventdata -> userto = clone ( $ eventdata -> userto ) ; $ eventdata -> userfrom = clone ( $ ... | Send message to message processors . |
28,138 | protected static function process_buffer ( ) { $ messages = self :: $ buffer ; self :: $ buffer = array ( ) ; $ convmessages = self :: $ convmessagebuffer ; self :: $ convmessagebuffer = array ( ) ; foreach ( $ messages as $ message ) { list ( $ eventdata , $ savemessage , $ processorlist ) = $ message ; self :: send_m... | Sent out any buffered messages if necessary . |
28,139 | public function management_method_selector ( grading_manager $ manager , moodle_url $ targeturl ) { $ method = $ manager -> get_active_method ( ) ; $ methods = $ manager -> get_available_methods ( false ) ; $ methods [ 'none' ] = get_string ( 'gradingmethodnone' , 'core_grading' ) ; $ selector = new single_select ( new... | Renders the active method selector at the grading method management screen |
28,140 | public function management_message ( $ message ) { $ this -> page -> requires -> strings_for_js ( array ( 'clicktoclose' ) , 'core_grading' ) ; $ this -> page -> requires -> yui_module ( 'moodle-core_grading-manage' , 'M.core_grading.init_manage' ) ; return $ this -> output -> box ( format_string ( $ message ) . ' - ' ... | Renders a message for the user typically as an action result |
28,141 | public function pick_action_icon ( moodle_url $ url , $ text , $ icon = '' , $ class = '' ) { $ img = $ this -> output -> pix_icon ( $ icon , '' ) ; $ txt = html_writer :: tag ( 'div' , $ text , array ( 'class' => 'action-text' ) ) ; return html_writer :: link ( $ url , $ img . $ txt , array ( 'class' => 'action ' . $ ... | Renders the template action icon |
28,142 | public static function message_paypal_error_to_admin ( $ subject , $ data ) { $ admin = get_admin ( ) ; $ site = get_site ( ) ; $ message = "$site->fullname: Transaction failed.\n\n$subject\n\n" ; foreach ( $ data as $ key => $ value ) { $ message .= "$key => $value\n" ; } $ eventdata = new \ core \ message \ message ... | Alerts site admin of potential problems . |
28,143 | public static function get_exception_handler ( ) { return function ( $ ex ) { $ info = get_exception_info ( $ ex ) ; $ logerrmsg = "enrol_paypal IPN exception handler: " . $ info -> message ; if ( debugging ( '' , DEBUG_NORMAL ) ) { $ logerrmsg .= ' Debug: ' . $ info -> debuginfo . "\n" . format_backtrace ( $ info -> b... | Silent exception handler . |
28,144 | protected function getWorksheetFromExternalSheet ( $ sheet ) { $ worksheetFound = null ; foreach ( $ this -> worksheets as $ worksheet ) { if ( $ worksheet -> getExternalSheet ( ) === $ sheet ) { $ worksheetFound = $ worksheet ; break ; } } return $ worksheetFound ; } | Returns the worksheet associated to the given external sheet . |
28,145 | public function addRowToCurrentWorksheet ( $ dataRow , $ style ) { $ currentWorksheet = $ this -> getCurrentWorksheet ( ) ; $ hasReachedMaxRows = $ this -> hasCurrentWorkseetReachedMaxRows ( ) ; $ styleHelper = $ this -> getStyleHelper ( ) ; if ( $ hasReachedMaxRows ) { if ( $ this -> shouldCreateNewSheetsAutomatically... | Adds data to the current sheet . If shouldCreateNewSheetsAutomatically option is set to true it will handle pagination with the creation of new worksheets if one worksheet has reached its maximum capicity . |
28,146 | public function col_select ( $ data ) { if ( $ data -> status == \ tool_dataprivacy \ api :: DATAREQUEST_STATUS_AWAITING_APPROVAL ) { if ( $ data -> type == \ tool_dataprivacy \ api :: DATAREQUEST_TYPE_DELETE && ! api :: can_create_data_deletion_request_for_other ( ) ) { return false ; } $ stringdata = [ 'username' => ... | The select column . |
28,147 | public function col_userid ( $ data ) { $ user = $ data -> foruser ; return html_writer :: link ( $ user -> profileurl , $ user -> fullname , [ 'title' => get_string ( 'viewprofile' ) ] ) ; } | The user column . |
28,148 | public function col_requestedby ( $ data ) { $ user = $ data -> requestedbyuser ; return html_writer :: link ( $ user -> profileurl , $ user -> fullname , [ 'title' => get_string ( 'viewprofile' ) ] ) ; } | The requesting user s column . |
28,149 | public function print_nothing_to_display ( ) { global $ OUTPUT ; echo $ this -> render_reset_button ( ) ; $ this -> print_initials_bar ( ) ; if ( ! empty ( $ this -> statuses ) || ! empty ( $ this -> types ) ) { $ message = get_string ( 'nodatarequestsmatchingfilter' , 'tool_dataprivacy' ) ; } else { $ message = get_st... | Override default implementation to display a more meaningful information to the user . |
28,150 | public function wrap_html_finish ( ) { global $ OUTPUT ; $ data = new stdClass ( ) ; $ data -> options = [ [ 'value' => 0 , 'name' => '' ] , [ 'value' => \ tool_dataprivacy \ api :: DATAREQUEST_ACTION_APPROVE , 'name' => get_string ( 'approve' , 'tool_dataprivacy' ) ] , [ 'value' => \ tool_dataprivacy \ api :: DATAREQU... | Override the table s wrap_html_finish method in order to render the bulk actions and records per page options . |
28,151 | protected function render_event_message ( event_message $ eventmessage ) { global $ CFG ; if ( file_exists ( $ CFG -> dirroot . '/mod/chat/gui_ajax/theme/' . $ eventmessage -> theme . '/config.php' ) ) { include ( $ CFG -> dirroot . '/mod/chat/gui_ajax/theme/' . $ eventmessage -> theme . '/config.php' ) ; } $ patterns ... | Render and event_message instance |
28,152 | protected function render_user_message ( user_message $ usermessage ) { global $ CFG ; if ( file_exists ( $ CFG -> dirroot . '/mod/chat/gui_ajax/theme/' . $ usermessage -> theme . '/config.php' ) ) { include ( $ CFG -> dirroot . '/mod/chat/gui_ajax/theme/' . $ usermessage -> theme . '/config.php' ) ; } $ patterns = arr... | Render a user message |
28,153 | public static function setSSL ( $ enabled , $ validate = true ) { self :: $ useSSL = $ enabled ; self :: $ useSSLValidation = $ validate ; } | Set SSL on or off |
28,154 | public static function setProxy ( $ host , $ user = null , $ pass = null , $ type = CURLPROXY_SOCKS5 ) { self :: $ proxy = array ( 'host' => $ host , 'type' => $ type , 'user' => $ user , 'pass' => $ pass ) ; } | Set proxy information |
28,155 | public static function putBucket ( $ bucket , $ acl = self :: ACL_PRIVATE , $ location = false ) { $ rest = new S3Request ( 'PUT' , $ bucket , '' , self :: $ endpoint ) ; $ rest -> setAmzHeader ( 'x-amz-acl' , $ acl ) ; if ( $ location !== false ) { $ dom = new DOMDocument ; $ createBucketConfiguration = $ dom -> creat... | Put a bucket |
28,156 | public static function getObject ( $ bucket , $ uri , $ saveTo = false ) { $ rest = new S3Request ( 'GET' , $ bucket , $ uri , self :: $ endpoint ) ; if ( $ saveTo !== false ) { if ( is_resource ( $ saveTo ) ) $ rest -> fp = & $ saveTo ; else if ( ( $ rest -> fp = @ fopen ( $ saveTo , 'wb' ) ) !== false ) $ rest -> fil... | Get an object |
28,157 | public static function getObjectInfo ( $ bucket , $ uri , $ returnInfo = true ) { $ rest = new S3Request ( 'HEAD' , $ bucket , $ uri , self :: $ endpoint ) ; $ rest = $ rest -> getResponse ( ) ; if ( $ rest -> error === false && ( $ rest -> code !== 200 && $ rest -> code !== 404 ) ) $ rest -> error = array ( 'code' => ... | Get object information |
28,158 | public static function setBucketRedirect ( $ bucket = NULL , $ location = NULL ) { $ rest = new S3Request ( 'PUT' , $ bucket , '' , self :: $ endpoint ) ; if ( empty ( $ bucket ) || empty ( $ location ) ) { self :: __triggerError ( "S3::setBucketRedirect({$bucket}, {$location}): Empty parameter." , __FILE__ , __LINE__ ... | Set up a bucket redirection |
28,159 | public static function setBucketLogging ( $ bucket , $ targetBucket , $ targetPrefix = null ) { if ( $ targetBucket !== null && ( $ acp = self :: getAccessControlPolicy ( $ targetBucket , '' ) ) !== false ) { $ aclWriteSet = false ; $ aclReadSet = false ; foreach ( $ acp [ 'acl' ] as $ acl ) if ( $ acl [ 'type' ] == 'G... | Set logging for a bucket |
28,160 | public static function getBucketLogging ( $ bucket ) { $ rest = new S3Request ( 'GET' , $ bucket , '' , self :: $ endpoint ) ; $ rest -> setParameter ( 'logging' , null ) ; $ rest = $ rest -> getResponse ( ) ; if ( $ rest -> error === false && $ rest -> code !== 200 ) $ rest -> error = array ( 'code' => $ rest -> code ... | Get logging status for a bucket |
28,161 | public static function getBucketLocation ( $ bucket ) { $ rest = new S3Request ( 'GET' , $ bucket , '' , self :: $ endpoint ) ; $ rest -> setParameter ( 'location' , null ) ; $ rest = $ rest -> getResponse ( ) ; if ( $ rest -> error === false && $ rest -> code !== 200 ) $ rest -> error = array ( 'code' => $ rest -> cod... | Get a bucket s location |
28,162 | public static function getAccessControlPolicy ( $ bucket , $ uri = '' ) { $ rest = new S3Request ( 'GET' , $ bucket , $ uri , self :: $ endpoint ) ; $ rest -> setParameter ( 'acl' , null ) ; $ rest = $ rest -> getResponse ( ) ; if ( $ rest -> error === false && $ rest -> code !== 200 ) $ rest -> error = array ( 'code' ... | Get object or bucket Access Control Policy |
28,163 | public static function getAuthenticatedURL ( $ bucket , $ uri , $ lifetime , $ hostBucket = false , $ https = false ) { $ expires = self :: __getTime ( ) + $ lifetime ; $ uri = str_replace ( array ( '%2F' , '%2B' ) , array ( '/' , '+' ) , rawurlencode ( $ uri ) ) ; return sprintf ( ( $ https ? 'https' : 'http' ) . '://... | Get a query string authenticated URL |
28,164 | public static function getSignedPolicyURL ( $ policy ) { $ data = json_encode ( $ policy ) ; $ signature = '' ; if ( ! openssl_sign ( $ data , $ signature , self :: $ __signingKeyResource ) ) return false ; $ encoded = str_replace ( array ( '+' , '=' ) , array ( '-' , '_' , '~' ) , base64_encode ( $ data ) ) ; $ signat... | Get a CloudFront signed policy URL |
28,165 | public static function createDistribution ( $ bucket , $ enabled = true , $ cnames = array ( ) , $ comment = null , $ defaultRootObject = null , $ originAccessIdentity = null , $ trustedSigners = array ( ) ) { if ( ! extension_loaded ( 'openssl' ) ) { self :: __triggerError ( sprintf ( "S3::createDistribution({$bucket}... | Create a CloudFront distribution |
28,166 | public static function getDistribution ( $ distributionId ) { if ( ! extension_loaded ( 'openssl' ) ) { self :: __triggerError ( sprintf ( "S3::getDistribution($distributionId): %s" , "CloudFront functionality requires SSL" ) , __FILE__ , __LINE__ ) ; return false ; } $ useSSL = self :: $ useSSL ; self :: $ useSSL = tr... | Get CloudFront distribution info |
28,167 | public static function updateDistribution ( $ dist ) { if ( ! extension_loaded ( 'openssl' ) ) { self :: __triggerError ( sprintf ( "S3::updateDistribution({$dist['id']}): %s" , "CloudFront functionality requires SSL" ) , __FILE__ , __LINE__ ) ; return false ; } $ useSSL = self :: $ useSSL ; self :: $ useSSL = true ; $... | Update a CloudFront distribution |
28,168 | public static function deleteDistribution ( $ dist ) { if ( ! extension_loaded ( 'openssl' ) ) { self :: __triggerError ( sprintf ( "S3::deleteDistribution({$dist['id']}): %s" , "CloudFront functionality requires SSL" ) , __FILE__ , __LINE__ ) ; return false ; } $ useSSL = self :: $ useSSL ; self :: $ useSSL = true ; $... | Delete a CloudFront distribution |
28,169 | public static function listDistributions ( ) { if ( ! extension_loaded ( 'openssl' ) ) { self :: __triggerError ( sprintf ( "S3::listDistributions(): [%s] %s" , "CloudFront functionality requires SSL" ) , __FILE__ , __LINE__ ) ; return false ; } $ useSSL = self :: $ useSSL ; self :: $ useSSL = true ; $ rest = new S3Req... | Get a list of CloudFront distributions |
28,170 | public static function listOriginAccessIdentities ( ) { if ( ! extension_loaded ( 'openssl' ) ) { self :: __triggerError ( sprintf ( "S3::listOriginAccessIdentities(): [%s] %s" , "CloudFront functionality requires SSL" ) , __FILE__ , __LINE__ ) ; return false ; } self :: $ useSSL = true ; $ rest = new S3Request ( 'GET'... | List CloudFront Origin Access Identities |
28,171 | public static function invalidateDistribution ( $ distributionId , $ paths ) { if ( ! extension_loaded ( 'openssl' ) ) { self :: __triggerError ( sprintf ( "S3::invalidateDistribution(): [%s] %s" , "CloudFront functionality requires SSL" ) , __FILE__ , __LINE__ ) ; return false ; } $ useSSL = self :: $ useSSL ; self ::... | Invalidate objects in a CloudFront distribution |
28,172 | private static function __getCloudFrontInvalidationBatchXML ( $ paths , $ callerReference = '0' ) { $ dom = new DOMDocument ( '1.0' , 'UTF-8' ) ; $ dom -> formatOutput = true ; $ invalidationBatch = $ dom -> createElement ( 'InvalidationBatch' ) ; foreach ( $ paths as $ path ) $ invalidationBatch -> appendChild ( $ dom... | Get a InvalidationBatch DOMDocument |
28,173 | private static function __getCloudFrontDistributionConfigXML ( $ bucket , $ enabled , $ comment , $ callerReference = '0' , $ cnames = array ( ) , $ defaultRootObject = null , $ originAccessIdentity = null , $ trustedSigners = array ( ) ) { $ dom = new DOMDocument ( '1.0' , 'UTF-8' ) ; $ dom -> formatOutput = true ; $ ... | Get a DistributionConfig DOMDocument |
28,174 | private static function __parseCloudFrontDistributionConfig ( & $ node ) { if ( isset ( $ node -> DistributionConfig ) ) return self :: __parseCloudFrontDistributionConfig ( $ node -> DistributionConfig ) ; $ dist = array ( ) ; if ( isset ( $ node -> Id , $ node -> Status , $ node -> LastModifiedTime , $ node -> Domain... | Parse a CloudFront distribution config |
28,175 | private static function __getCloudFrontResponse ( & $ rest ) { $ rest -> getResponse ( ) ; if ( $ rest -> response -> error === false && isset ( $ rest -> response -> body ) && is_string ( $ rest -> response -> body ) && substr ( $ rest -> response -> body , 0 , 5 ) == '<?xml' ) { $ rest -> response -> body = simplexml... | Grab CloudFront response |
28,176 | private static function __getHash ( $ string ) { return base64_encode ( extension_loaded ( 'hash' ) ? hash_hmac ( 'sha1' , $ string , self :: $ __secretKey , true ) : pack ( 'H*' , sha1 ( ( str_pad ( self :: $ __secretKey , 64 , chr ( 0x00 ) ) ^ ( str_repeat ( chr ( 0x5c ) , 64 ) ) ) . pack ( 'H*' , sha1 ( ( str_pad ( ... | Creates a HMAC - SHA1 hash |
28,177 | private function __sortMetaHeadersCmp ( $ a , $ b ) { $ lenA = strpos ( $ a , ':' ) ; $ lenB = strpos ( $ b , ':' ) ; $ minLen = min ( $ lenA , $ lenB ) ; $ ncmp = strncmp ( $ a , $ b , $ minLen ) ; if ( $ lenA == $ lenB ) return $ ncmp ; if ( 0 == $ ncmp ) return $ lenA < $ lenB ? - 1 : 1 ; return $ ncmp ; } | Sort compare for meta headers |
28,178 | private function __responseWriteCallback ( & $ curl , & $ data ) { if ( in_array ( $ this -> response -> code , array ( 200 , 206 ) ) && $ this -> fp !== false ) return fwrite ( $ this -> fp , $ data ) ; else $ this -> response -> body .= $ data ; return strlen ( $ data ) ; } | CURL write callback |
28,179 | private function __responseHeaderCallback ( $ curl , $ data ) { if ( ( $ strlen = strlen ( $ data ) ) <= 2 ) return $ strlen ; if ( substr ( $ data , 0 , 4 ) == 'HTTP' ) $ this -> response -> code = ( int ) substr ( $ data , 9 , 3 ) ; else { $ data = trim ( $ data ) ; if ( strpos ( $ data , ': ' ) === false ) return $ ... | CURL header callback |
28,180 | public static function create_from_object ( field_controller $ field ) : field_created { $ eventparams = [ 'objectid' => $ field -> get ( 'id' ) , 'context' => $ field -> get_handler ( ) -> get_configuration_context ( ) , 'other' => [ 'shortname' => $ field -> get ( 'shortname' ) , 'name' => $ field -> get ( 'name' ) ]... | Creates an instance from a field controller object |
28,181 | public function readfile ( stored_file $ file ) { if ( $ this -> is_file_readable_locally_by_storedfile ( $ file , false ) ) { $ path = $ this -> get_local_path_from_storedfile ( $ file , false ) ; } else { $ path = $ this -> get_remote_path_from_storedfile ( $ file ) ; } readfile_allow_large ( $ path , $ file -> get_f... | Output the content of the specified stored file . |
28,182 | protected function get_local_path_from_storedfile ( stored_file $ file , $ fetchifnotfound = false ) { return $ this -> get_local_path_from_hash ( $ file -> get_contenthash ( ) , $ fetchifnotfound ) ; } | Get the full path on disk for the specified stored file . |
28,183 | public function is_file_readable_remotely_by_storedfile ( stored_file $ file ) { if ( ! $ file -> get_filesize ( ) ) { return true ; } $ path = $ this -> get_remote_path_from_storedfile ( $ file , false ) ; if ( is_readable ( $ path ) ) { return true ; } return false ; } | Determine whether the file is present on the local file system somewhere . |
28,184 | public function is_file_readable_locally_by_hash ( $ contenthash , $ fetchifnotfound = false ) { if ( $ contenthash === file_storage :: hash_from_string ( '' ) ) { return true ; } $ path = $ this -> get_local_path_from_hash ( $ contenthash , $ fetchifnotfound ) ; return is_readable ( $ path ) ; } | Determine whether the file is present on the file system somewhere given the contenthash . |
28,185 | public function is_file_readable_remotely_by_hash ( $ contenthash ) { if ( $ contenthash === file_storage :: hash_from_string ( '' ) ) { return true ; } $ path = $ this -> get_remote_path_from_hash ( $ contenthash , false ) ; return is_readable ( $ path ) ; } | Determine whether the file is present locally on the file system somewhere given the contenthash . |
28,186 | protected static function is_file_removable ( $ contenthash ) { global $ DB ; if ( $ contenthash === file_storage :: hash_from_string ( '' ) ) { return false ; } if ( $ DB -> record_exists ( 'files' , array ( 'contenthash' => $ contenthash ) ) ) { return false ; } return true ; } | Check whether a file is removable . |
28,187 | public function get_content ( stored_file $ file ) { if ( ! $ file -> get_filesize ( ) ) { return '' ; } $ source = $ this -> get_remote_path_from_storedfile ( $ file ) ; return file_get_contents ( $ source ) ; } | Get the content of the specified stored file . |
28,188 | public function list_files ( $ file , file_packer $ packer ) { $ archivefile = $ this -> get_local_path_from_storedfile ( $ file , true ) ; return $ packer -> list_files ( $ archivefile ) ; } | List contents of archive . |
28,189 | public function get_imageinfo ( stored_file $ file ) { if ( ! $ this -> is_image_from_storedfile ( $ file ) ) { return false ; } return $ this -> get_imageinfo_from_path ( $ this -> get_local_path_from_storedfile ( $ file , true ) ) ; } | Returns information about image . Information is determined from the file content |
28,190 | public function is_image_from_storedfile ( stored_file $ file ) { if ( ! $ file -> get_filesize ( ) ) { return false ; } $ mimetype = $ file -> get_mimetype ( ) ; if ( ! preg_match ( '|^image/|' , $ mimetype ) ) { return false ; } return true ; } | Attempt to determine whether the specified file is likely to be an image . Since this relies upon the mimetype stored in the files table there may be times when this information is not 100% accurate . |
28,191 | protected function get_imageinfo_from_path ( $ path ) { $ imageinfo = getimagesize ( $ path ) ; $ image = array ( 'width' => $ imageinfo [ 0 ] , 'height' => $ imageinfo [ 1 ] , 'mimetype' => image_type_to_mime_type ( $ imageinfo [ 2 ] ) , ) ; if ( empty ( $ image [ 'width' ] ) or empty ( $ image [ 'height' ] ) or empty... | Returns image information relating to the specified path or URL . |
28,192 | protected function validate_hash_and_file_size ( $ contenthash , $ pathname ) { global $ CFG ; if ( ! is_readable ( $ pathname ) ) { throw new file_exception ( 'storedfilecannotread' , '' , $ pathname ) ; } $ filesize = filesize ( $ pathname ) ; if ( $ filesize === false ) { throw new file_exception ( 'storedfilecannot... | Validate that the content hash matches the content hash of the file on disk . |
28,193 | public function get_content_file_handle ( stored_file $ file , $ type = stored_file :: FILE_HANDLE_FOPEN ) { if ( $ type === stored_file :: FILE_HANDLE_GZOPEN ) { $ path = $ this -> get_local_path_from_storedfile ( $ file , true ) ; } else { $ path = $ this -> get_remote_path_from_storedfile ( $ file ) ; } return self ... | Returns file handle - read only mode no writing allowed into pool files! |
28,194 | protected static function get_file_handle_for_path ( $ path , $ type = stored_file :: FILE_HANDLE_FOPEN ) { switch ( $ type ) { case stored_file :: FILE_HANDLE_FOPEN : return fopen ( $ path , 'rb' ) ; case stored_file :: FILE_HANDLE_GZOPEN : return gzopen ( $ path , 'rb' ) ; default : throw new coding_exception ( 'Unex... | Return a file handle for the specified path . |
28,195 | protected function render_workshopallocation_manual_allocations ( workshopallocation_manual_allocations $ data ) { $ this -> workshop = $ data -> workshop ; $ allocations = $ data -> allocations ; $ userinfo = $ data -> userinfo ; $ authors = $ data -> authors ; $ reviewers = $ data -> reviewers ; $ hlauthorid = $ data... | Display the table of all current allocations and widgets to modify them |
28,196 | protected function helper_participant ( stdclass $ allocation , array $ userinfo ) { $ o = $ this -> output -> user_picture ( $ userinfo [ $ allocation -> userid ] , array ( 'courseid' => $ this -> page -> course -> id ) ) ; $ o .= fullname ( $ userinfo [ $ allocation -> userid ] ) ; $ o .= $ this -> output -> containe... | Returns information about the workshop participant |
28,197 | protected function helper_reviewers_of_participant ( stdclass $ allocation , array $ userinfo , array $ reviewers , $ selfassessment ) { $ o = '' ; if ( is_null ( $ allocation -> submissionid ) ) { $ o .= $ this -> output -> container ( get_string ( 'nothingtoreview' , 'workshop' ) , 'info' ) ; } else { $ exclude = arr... | Returns information about the current reviewers of the given participant and a selector do add new one |
28,198 | function renderElement ( & $ element , $ required , $ error ) { $ elAry = $ this -> _elementToArray ( $ element , $ required , $ error ) ; if ( ! empty ( $ error ) ) { $ this -> _ary [ 'errors' ] [ $ elAry [ 'name' ] ] = $ error ; } $ this -> _storeArray ( $ elAry ) ; } | end func renderHeader |
28,199 | function _elementToArray ( & $ element , $ required , $ error ) { $ ret = array ( 'name' => $ element -> getName ( ) , 'value' => $ element -> getValue ( ) , 'type' => $ element -> getType ( ) , 'frozen' => $ element -> isFrozen ( ) , 'required' => $ required , 'error' => $ error ) ; $ labels = $ element -> getLabel ( ... | Creates an array representing an element |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.