idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
31,800 | public static function getPath ( $ class ) { if ( strncmp ( 'HTMLPurifier' , $ class , 12 ) !== 0 ) { return false ; } if ( strncmp ( 'HTMLPurifier_Language_' , $ class , 22 ) === 0 ) { $ code = str_replace ( '_' , '-' , substr ( $ class , 22 ) ) ; $ file = 'HTMLPurifier/Language/classes/' . $ code . '.php' ; } else { ... | Returns the path for a specific class . |
31,801 | function toHtml ( ) { $ arrayName = str_replace ( array ( '[' , ']' ) , array ( '__' , '' ) , $ this -> getName ( ) ) . '_values' ; $ this -> updateAttributes ( array ( 'onkeypress' => 'return autocomplete(this, event, ' . $ arrayName . ');' ) ) ; if ( $ this -> _flagFrozen ) { $ js = '' ; } else { $ js = "<script type... | Returns Html for the autocomplete input text element |
31,802 | public static function get_gradingform_export_data ( \ context $ context , $ definition , int $ userid ) { debugging ( 'This method is deprecated. Please use the gradingform_provider_v2 interface' , DEBUG_DEVELOPER ) ; return static :: _get_gradingform_export_data ( $ context , $ definition , $ userid ) ; } | This method is used to export any user data this sub - plugin has using the object to get the context and userid . |
31,803 | public function process_assignsubmission_file_submission ( $ data ) { global $ DB ; $ data = ( object ) $ data ; $ data -> assignment = $ this -> get_new_parentid ( 'assign' ) ; $ oldsubmissionid = $ data -> submission ; $ data -> submission = $ this -> get_mappingid ( 'submission' , $ data -> submission ) ; $ DB -> in... | Processes one submission_file element |
31,804 | protected static function find_php_cli_path ( ) { global $ CFG ; if ( ! empty ( $ CFG -> pathtophp ) && is_executable ( trim ( $ CFG -> pathtophp ) ) ) { return $ CFG -> pathtophp ; } return false ; } | Find the path of PHP CLI binary . |
31,805 | public static function execute ( \ core \ task \ task_base $ task ) : bool { global $ CFG ; if ( ! self :: is_runnable ( ) ) { $ redirecturl = new \ moodle_url ( '/admin/settings.php' , [ 'section' => 'systempaths' ] ) ; throw new \ moodle_exception ( 'cannotfindthepathtothecli' , 'tool_task' , $ redirecturl -> out ( )... | Executes a cron from web invocation using PHP CLI . |
31,806 | public function addFromString ( $ localname , $ contents ) { $ filenameParts = pathinfo ( $ localname ) ; $ handle = fopen ( $ this -> tempDir . '/' . $ filenameParts [ "basename" ] , "wb" ) ; fwrite ( $ handle , $ contents ) ; fclose ( $ handle ) ; $ res = $ this -> zip -> add ( $ this -> tempDir . '/' . $ filenamePar... | Add a new file to the zip archive from a string of raw data . |
31,807 | public function close ( ) { if ( ! isset ( $ this -> za ) ) { return false ; } if ( $ this -> emptyziphack ) { @ $ this -> za -> close ( ) ; $ this -> za = null ; $ this -> mode = null ; $ this -> namelookup = null ; $ this -> modified = false ; @ unlink ( $ this -> emptyziphack ) ; $ this -> emptyziphack = false ; ret... | Close archive write changes to disk . |
31,808 | public function get_stream ( $ index ) { if ( ! isset ( $ this -> za ) ) { return false ; } $ name = $ this -> za -> getNameIndex ( $ index ) ; if ( $ name === false ) { return false ; } return $ this -> za -> getStream ( $ name ) ; } | Returns file stream for reading of content . |
31,809 | public function get_info ( $ index ) { if ( ! isset ( $ this -> za ) ) { return false ; } if ( $ index < 0 or $ index >= $ this -> za -> numFiles ) { return false ; } $ result = $ this -> za -> statIndex ( $ index , 64 ) ; if ( $ result === false ) { return false ; } $ info = new stdClass ( ) ; $ info -> index = $ inde... | Returns file information . |
31,810 | public function add_file_from_pathname ( $ localname , $ pathname ) { if ( $ this -> emptyziphack ) { $ this -> close ( ) ; $ this -> open ( $ this -> archivepathname , file_archive :: OVERWRITE , $ this -> encoding ) ; } if ( ! isset ( $ this -> za ) ) { return false ; } if ( $ this -> archivepathname === realpath ( $... | Add file into archive . |
31,811 | public function add_file_from_string ( $ localname , $ contents ) { if ( $ this -> emptyziphack ) { $ this -> close ( ) ; $ this -> open ( $ this -> archivepathname , file_archive :: OVERWRITE , $ this -> encoding ) ; } if ( ! isset ( $ this -> za ) ) { return false ; } $ localname = trim ( $ localname , '/' ) ; $ loca... | Add content of string into archive . |
31,812 | public function add_directory ( $ localname ) { if ( $ this -> emptyziphack ) { $ this -> close ( ) ; $ this -> open ( $ this -> archivepathname , file_archive :: OVERWRITE , $ this -> encoding ) ; } if ( ! isset ( $ this -> za ) ) { return false ; } $ localname = trim ( $ localname , '/' ) . '/' ; $ localname = $ this... | Add empty directory into archive . |
31,813 | public function valid ( ) { if ( ! isset ( $ this -> za ) ) { return false ; } while ( ! $ this -> get_info ( $ this -> pos ) && $ this -> pos < $ this -> za -> numFiles ) { $ this -> next ( ) ; } if ( $ this -> pos >= $ this -> za -> numFiles ) { return false ; } return true ; } | Did we reach the end? |
31,814 | public static function zip_get_central_end ( $ fp , $ filesize ) { fseek ( $ fp , $ filesize - 22 ) ; $ info = unpack ( 'Vsig' , fread ( $ fp , 4 ) ) ; if ( $ info [ 'sig' ] === 0x06054b50 ) { fseek ( $ fp , $ filesize - 22 ) ; $ data = fread ( $ fp , 22 ) ; } else { fseek ( $ fp , $ filesize - 65557 ) ; $ data = fread... | Read end of central signature of ZIP file . |
31,815 | public static function zip_parse_file_header ( $ data , $ centralend , & $ pos ) { $ file = unpack ( 'Vsig/vversion/vversion_req/vgeneral/vmethod/Vmodified/Vcrc/Vsize_compressed/Vsize/vname_length/vextra_length/vcomment_length/vdisk/vattr/Vattrext/Vlocal_offset' , substr ( $ data , $ pos , 46 ) ) ; $ file [ 'central_of... | Parse file header . |
31,816 | public function authenticateForScope ( $ scopes ) { if ( $ this -> token && $ this -> tokenScopes == $ scopes ) { return $ this -> token ; } $ cacheKey = self :: CACHE_PREFIX ; if ( is_string ( $ scopes ) ) { $ cacheKey .= $ scopes ; } else if ( is_array ( $ scopes ) ) { $ cacheKey .= implode ( ":" , $ scopes ) ; } $ t... | Retrieve an access token for the scopes supplied . |
31,817 | private function retrieveToken ( $ scopes , $ cacheKey ) { $ this -> token = AppIdentityService :: getAccessToken ( $ scopes ) ; if ( $ this -> token ) { $ this -> client -> getCache ( ) -> set ( $ cacheKey , $ this -> token ) ; } } | Retrieve a new access token and store it in cache |
31,818 | protected function get_filepicker_unique_id ( ) : string { if ( empty ( $ this -> filepickeruniqueid ) ) { $ this -> filepickeruniqueid = uniqid ( ) ; } return $ this -> filepickeruniqueid ; } | Returns the unique id of the file picker associated with this url element setting it in the process if not set . |
31,819 | public function add ( $ ids ) { if ( ! is_null ( $ ids ) ) { if ( is_string ( $ ids ) && in_array ( $ ids , array ( self :: ALL , self :: SEARCH_RES , self :: LARGEST ) ) ) { $ this -> _ids = $ ids ; } elseif ( $ add = $ this -> _resolveIds ( $ ids ) ) { if ( is_array ( $ this -> _ids ) && ! empty ( $ this -> _ids ) ) ... | Add IDs to the current object . |
31,820 | public function remove ( $ ids ) { if ( ! $ this -> isEmpty ( ) && ( $ remove = $ this -> _resolveIds ( $ ids ) ) ) { $ this -> _ids = array_diff ( $ this -> _ids , array_unique ( $ remove ) ) ; } } | Removed IDs from the current object . |
31,821 | public function sort ( ) { if ( ! $ this -> _sorted && is_array ( $ this -> _ids ) ) { $ this -> _sort ( $ this -> _ids ) ; $ this -> _sorted = true ; } } | Sorts the IDs . |
31,822 | public function split ( $ length ) { $ id = new Horde_Stream_Temp ( ) ; $ id -> add ( $ this -> tostring_sort , true ) ; $ out = array ( ) ; do { $ out [ ] = $ id -> substring ( 0 , $ length ) . $ id -> getToChar ( ',' ) ; } while ( ! $ id -> eof ( ) ) ; return $ out ; } | Split the sequence string at an approximate length . |
31,823 | protected function _toSequenceString ( $ sort = true ) { if ( empty ( $ this -> _ids ) ) { return '' ; } $ in = $ this -> _ids ; if ( $ sort && ! $ this -> _sorted ) { $ this -> _sort ( $ in ) ; } $ first = $ last = array_shift ( $ in ) ; $ i = count ( $ in ) - 1 ; $ out = array ( ) ; foreach ( $ in as $ key => $ val )... | Create an IMAP message sequence string from a list of indices . |
31,824 | protected function _fromSequenceString ( $ str ) { $ ids = array ( ) ; $ str = trim ( $ str ) ; if ( ! strlen ( $ str ) ) { return $ ids ; } $ idarray = explode ( ',' , $ str ) ; foreach ( $ idarray as $ val ) { $ range = explode ( ':' , $ val ) ; if ( isset ( $ range [ 1 ] ) ) { for ( $ i = min ( $ range ) , $ j = max... | Parse an IMAP message sequence string into a list of indices . |
31,825 | public function validation ( $ data , $ files ) { $ errors = parent :: validation ( $ data , $ files ) ; list ( $ instance , $ plugin , $ context , $ type ) = $ this -> _customdata ; $ pluginerrors = $ plugin -> edit_instance_validation ( $ data , $ files , $ instance , $ context ) ; $ errors = array_merge ( $ errors ,... | Validate this form . Calls plugin validation method . |
31,826 | public function definition_after_data ( ) { global $ USER , $ CFG , $ DB , $ OUTPUT ; $ mform = $ this -> _form ; foreach ( useredit_get_required_name_fields ( ) as $ field ) { $ mform -> applyFilter ( $ field , 'trim' ) ; } if ( $ userid = $ mform -> getElementValue ( 'id' ) ) { $ user = $ DB -> get_record ( 'user' , ... | Extend the form definition after data has been parsed . |
31,827 | public function setPrintAreaByColumnAndRow ( $ column1 , $ row1 , $ column2 , $ row2 , $ index = 0 , $ method = self :: SETPRINTRANGE_OVERWRITE ) { return $ this -> setPrintArea ( PHPExcel_Cell :: stringFromColumnIndex ( $ column1 ) . $ row1 . ':' . PHPExcel_Cell :: stringFromColumnIndex ( $ column2 ) . $ row2 , $ inde... | Set print area |
31,828 | function define_default_field ( ) { global $ OUTPUT ; if ( empty ( $ this -> data -> id ) ) { echo $ OUTPUT -> notification ( 'Programmer error: dataid not defined in field class' ) ; } $ this -> field = new stdClass ( ) ; $ this -> field -> id = 0 ; $ this -> field -> dataid = $ this -> data -> id ; $ this -> field ->... | This field just sets up a default field object |
31,829 | function define_field ( $ data ) { $ this -> field -> type = $ this -> type ; $ this -> field -> dataid = $ this -> data -> id ; $ this -> field -> name = trim ( $ data -> name ) ; $ this -> field -> description = trim ( $ data -> description ) ; $ this -> field -> required = ! empty ( $ data -> required ) ? 1 : 0 ; if... | Set up the field object according to data in an object . Now is the time to clean it! |
31,830 | function update_field ( ) { global $ DB ; $ DB -> update_record ( 'data_fields' , $ this -> field ) ; $ event = \ mod_data \ event \ field_updated :: create ( array ( 'objectid' => $ this -> field -> id , 'context' => $ this -> context , 'other' => array ( 'fieldname' => $ this -> field -> name , 'dataid' => $ this -> ... | Update a field in the database |
31,831 | function delete_field ( ) { global $ DB ; if ( ! empty ( $ this -> field -> id ) ) { $ field = $ DB -> get_record ( 'data_fields' , array ( 'id' => $ this -> field -> id ) ) ; $ this -> delete_content ( ) ; $ DB -> delete_records ( 'data_fields' , array ( 'id' => $ this -> field -> id ) ) ; $ event = \ mod_data \ event... | Delete a field completely |
31,832 | function display_add_field ( $ recordid = 0 , $ formdata = null ) { global $ DB , $ OUTPUT ; if ( $ formdata ) { $ fieldname = 'field_' . $ this -> field -> id ; $ content = $ formdata -> $ fieldname ; } else if ( $ recordid ) { $ content = $ DB -> get_field ( 'data_content' , 'content' , array ( 'fieldid' => $ this ->... | Print the relevant form element in the ADD template for this field |
31,833 | function display_edit_field ( ) { global $ CFG , $ DB , $ OUTPUT ; if ( empty ( $ this -> field ) ) { $ this -> define_default_field ( ) ; } echo $ OUTPUT -> box_start ( 'generalbox boxaligncenter boxwidthwide' ) ; echo '<form id="editfield" action="' . $ CFG -> wwwroot . '/mod/data/field.php" method="post">' . "\n" ; ... | Print the relevant form element to define the attributes for this field viewable by teachers only . |
31,834 | function update_content ( $ recordid , $ value , $ name = '' ) { global $ DB ; $ content = new stdClass ( ) ; $ content -> fieldid = $ this -> field -> id ; $ content -> recordid = $ recordid ; $ content -> content = clean_param ( $ value , PARAM_NOTAGS ) ; if ( $ oldcontent = $ DB -> get_record ( 'data_content' , arra... | Update the content of one data field in the data_content table |
31,835 | function delete_content ( $ recordid = 0 ) { global $ DB ; if ( $ recordid ) { $ conditions = array ( 'fieldid' => $ this -> field -> id , 'recordid' => $ recordid ) ; } else { $ conditions = array ( 'fieldid' => $ this -> field -> id ) ; } $ rs = $ DB -> get_recordset ( 'data_content' , $ conditions ) ; if ( $ rs -> v... | Delete all content associated with the field |
31,836 | function image ( ) { global $ OUTPUT ; $ params = array ( 'd' => $ this -> data -> id , 'fid' => $ this -> field -> id , 'mode' => 'display' , 'sesskey' => sesskey ( ) ) ; $ link = new moodle_url ( '/mod/data/field.php' , $ params ) ; $ str = '<a href="' . $ link -> out ( ) . '">' ; $ str .= $ OUTPUT -> pix_icon ( 'fie... | Prints the respective type icon |
31,837 | public function data_preset_get_file_contents ( & $ filestorage , & $ fileobj , $ dir , $ filename ) { if ( empty ( $ filestorage ) || empty ( $ fileobj ) ) { if ( substr ( $ dir , - 1 ) != '/' ) { $ dir .= '/' ; } if ( file_exists ( $ dir . $ filename ) ) { return file_get_contents ( $ dir . $ filename ) ; } else { re... | Retreive the contents of a file . That file may either be in a conventional directory of the Moodle file storage |
31,838 | public static function get_by_courseid ( $ courseid ) { global $ DB ; $ params = array ( 'courseid' => $ courseid ) ; $ settings = new static ( null , ( object ) $ params ) ; if ( $ record = $ DB -> get_record ( self :: TABLE , $ params ) ) { $ settings -> from_record ( $ record ) ; } return $ settings ; } | Get a the course settings for a single course . |
31,839 | public static function can_read ( $ courseid ) { $ context = context_course :: instance ( $ courseid ) ; $ capabilities = array ( 'moodle/competency:coursecompetencyview' , 'moodle/competency:coursecompetencymanage' ) ; return has_any_capability ( $ capabilities , $ context ) ; } | Can the current user view competency settings for this course . |
31,840 | public static function can_manage_course ( $ courseid ) { $ context = context_course :: instance ( $ courseid ) ; $ capabilities = array ( 'moodle/competency:coursecompetencyconfigure' ) ; return has_any_capability ( $ capabilities , $ context ) ; } | Can the current user change competency settings for this course . |
31,841 | protected function redirect_to_policies ( $ userid , $ returnurl = null ) { $ allpolicies = $ this -> policies ; if ( $ this -> isexistinguser ) { $ acceptances = api :: get_user_acceptances ( $ userid ) ; foreach ( $ allpolicies as $ ix => $ policy ) { $ isaccepted = api :: is_user_version_accepted ( $ userid , $ poli... | Before display the consent page the user has to view all the still - non - accepted policy docs . This function checks if the non - accepted policy docs have been shown and redirect to them . |
31,842 | protected function prepare_user_acceptances ( $ userid ) { global $ USER ; $ lang = current_language ( ) ; foreach ( $ this -> policies as $ policy ) { $ policy -> url = new moodle_url ( '/admin/tool/policy/view.php' , array ( 'policyid' => $ policy -> policyid , 'returnurl' => qualified_me ( ) ) ) ; $ policyattributes... | Prepare user acceptances . |
31,843 | protected function generate_configuration_array ( ) { $ configuration = array ( ) ; $ configuration [ 'stores' ] = $ this -> configstores ; $ configuration [ 'modemappings' ] = $ this -> configmodemappings ; $ configuration [ 'definitions' ] = $ this -> configdefinitions ; $ configuration [ 'definitionmappings' ] = $ t... | Generates a configuration array suitable to be written to the config file . |
31,844 | public function get_listing ( $ path = null , $ page = null ) { global $ COURSE ; $ callbackurl = new moodle_url ( '/repository/equella/callback.php' , array ( 'repo_id' => $ this -> id ) ) ; $ mimetypesstr = '' ; $ restrict = '' ; if ( ! empty ( $ this -> mimetypes ) ) { $ mimetypesstr = '&mimeTypes=' . implode ( ',' ... | Display embedded equella interface |
31,845 | private function connection_result ( $ errno = null ) { static $ countfailures = array ( ) ; $ sess = sesskey ( ) ; if ( ! array_key_exists ( $ sess , $ countfailures ) ) { $ countfailures [ $ sess ] = 0 ; } if ( $ errno !== null ) { if ( $ errno == 0 ) { $ countfailures [ $ sess ] = 0 ; } else if ( $ errno == 7 || $ e... | Counts the number of failed connections . |
31,846 | public static function get_instance_option_names ( ) { $ rv = array ( 'equella_url' , 'equella_select_restriction' , 'equella_options' , 'equella_shareid' , 'equella_sharedsecret' ) ; foreach ( self :: get_all_editing_roles ( ) as $ role ) { array_push ( $ rv , "equella_{$role->shortname}_shareid" ) ; array_push ( $ rv... | Names of the instance settings |
31,847 | private static function getssotoken_raw ( $ username , $ shareid , $ sharedsecret ) { $ time = time ( ) . '000' ; return urlencode ( $ username ) . ':' . $ shareid . ':' . $ time . ':' . base64_encode ( pack ( 'H*' , md5 ( $ username . $ shareid . $ time . $ sharedsecret ) ) ) ; } | Generate equella token |
31,848 | private function getssotoken ( $ readwrite = 'read' ) { global $ USER ; if ( empty ( $ USER -> username ) ) { return false ; } if ( $ readwrite == 'write' ) { foreach ( self :: get_all_editing_roles ( ) as $ role ) { if ( user_has_role_assignment ( $ USER -> id , $ role -> id , $ this -> context -> id ) ) { $ shareid =... | Generate equella sso token |
31,849 | public function set_request_token_secret ( array $ identifiers , $ secret ) { if ( empty ( $ identifiers ) || empty ( $ identifiers [ 'caller' ] ) ) { throw new coding_exception ( 'Invalid call identification' ) ; } $ cache = cache :: make_from_params ( cache_store :: MODE_SESSION , 'core' , 'flickrclient' , $ identifi... | Temporarily store the request token secret in the session . |
31,850 | public function get_request_token_secret ( array $ identifiers ) { if ( empty ( $ identifiers ) || empty ( $ identifiers [ 'caller' ] ) ) { throw new coding_exception ( 'Invalid call identification' ) ; } $ cache = cache :: make_from_params ( cache_store :: MODE_SESSION , 'core' , 'flickrclient' , $ identifiers ) ; ret... | Returns previously stored request token secret . |
31,851 | public function call ( $ function , array $ params = [ ] , $ method = 'GET' ) { if ( strpos ( $ function , 'flickr.' ) !== 0 ) { $ function = 'flickr.' . $ function ; } $ params [ 'method' ] = $ function ; $ params [ 'format' ] = 'json' ; $ params [ 'nojsoncallback' ] = 1 ; $ rawresponse = $ this -> request ( $ method ... | Call a Flickr API method . |
31,852 | public function get_photo_url ( $ photoid ) { $ cache = cache :: make_from_params ( cache_store :: MODE_APPLICATION , 'core' , 'flickrclient' ) ; $ url = $ cache -> get ( 'photourl_' . $ photoid ) ; if ( $ url === false ) { $ response = $ this -> call ( 'photos.getSizes' , [ 'photo_id' => $ photoid ] ) ; if ( ! empty (... | Return the URL to fetch the given photo from . |
31,853 | public function upload ( stored_file $ photo , array $ meta = [ ] ) { $ args = [ 'title' => isset ( $ meta [ 'title' ] ) ? $ meta [ 'title' ] : null , 'description' => isset ( $ meta [ 'description' ] ) ? $ meta [ 'description' ] : null , 'tags' => isset ( $ meta [ 'tags' ] ) ? $ meta [ 'tags' ] : null , 'is_public' =>... | Upload a photo from Moodle file pool to Flickr . |
31,854 | protected function get_users_table ( array $ users , array $ statusoptions ) { $ table = new html_table ( ) ; $ table -> head = array ( get_string ( 'name' ) , get_string ( 'participationstatus' , 'enrol' ) , get_string ( 'enroltimestart' , 'enrol' ) , get_string ( 'enroltimeend' , 'enrol' ) , ) ; $ table -> data = arr... | Generates an HTML table to display the users being affected by the bulk change . |
31,855 | protected function createRootFolder ( ) { $ this -> rootFolder = $ this -> createFolder ( $ this -> baseFolderRealPath , uniqid ( 'xlsx' , true ) ) ; return $ this ; } | Creates the folder that will be used as root |
31,856 | protected function createRelsFolderAndFile ( ) { $ this -> relsFolder = $ this -> createFolder ( $ this -> rootFolder , self :: RELS_FOLDER_NAME ) ; $ this -> createRelsFile ( ) ; return $ this ; } | Creates the _rels folder under the root folder as well as the . rels file in it |
31,857 | protected function createDocPropsFolderAndFiles ( ) { $ this -> docPropsFolder = $ this -> createFolder ( $ this -> rootFolder , self :: DOC_PROPS_FOLDER_NAME ) ; $ this -> createAppXmlFile ( ) ; $ this -> createCoreXmlFile ( ) ; return $ this ; } | Creates the docProps folder under the root folder as well as the app . xml and core . xml files in it |
31,858 | protected function createAppXmlFile ( ) { $ appName = self :: APP_NAME ; $ appXmlFileContents = <<<EOD<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"> <Application>$appName</Application> <TotalTime>0</TotalTime><... | Creates the app . xml file under the docProps folder |
31,859 | protected function createCoreXmlFile ( ) { $ createdDate = ( new \ DateTime ( ) ) -> format ( \ DateTime :: W3C ) ; $ coreXmlFileContents = <<<EOD<?xml version="1.0" encoding="UTF-8" standalone="yes"?><cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http:/... | Creates the core . xml file under the docProps folder |
31,860 | protected function createXlFolderAndSubFolders ( ) { $ this -> xlFolder = $ this -> createFolder ( $ this -> rootFolder , self :: XL_FOLDER_NAME ) ; $ this -> createXlRelsFolder ( ) ; $ this -> createXlWorksheetsFolder ( ) ; return $ this ; } | Creates the xl folder under the root folder as well as its subfolders |
31,861 | protected function createXlRelsFolder ( ) { $ this -> xlRelsFolder = $ this -> createFolder ( $ this -> xlFolder , self :: RELS_FOLDER_NAME ) ; return $ this ; } | Creates the _rels folder under the xl folder |
31,862 | protected function createXlWorksheetsFolder ( ) { $ this -> xlWorksheetsFolder = $ this -> createFolder ( $ this -> xlFolder , self :: WORKSHEETS_FOLDER_NAME ) ; return $ this ; } | Creates the worksheets folder under the xl folder |
31,863 | public function createWorkbookFile ( $ worksheets ) { $ workbookXmlFileContents = <<<EOD<?xml version="1.0" encoding="UTF-8" standalone="yes"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"> <sheets>EOD ; $ es... | Creates the workbook . xml file under the xl folder |
31,864 | public function createStylesFile ( $ styleHelper ) { $ stylesXmlFileContents = $ styleHelper -> getStylesXMLFileContent ( ) ; $ this -> createFileWithContents ( $ this -> xlFolder , self :: STYLES_XML_FILE_NAME , $ stylesXmlFileContents ) ; return $ this ; } | Creates the styles . xml file under the xl folder |
31,865 | final public static function make ( backup_setting $ setting , $ type , $ label , array $ attributes = null , array $ options = null ) { switch ( $ type ) { case backup_setting :: UI_HTML_CHECKBOX : return new backup_setting_ui_checkbox ( $ setting , $ label , null , ( array ) $ attributes , ( array ) $ options ) ; cas... | Creates a new backup setting ui based on the setting it is given |
31,866 | public function get_label ( base_task $ task = null ) { if ( ! is_null ( $ task ) && $ this -> label == $ this -> setting -> get_name ( ) && strpos ( $ this -> setting -> get_name ( ) , '_include' ) !== false ) { if ( $ this -> setting -> get_level ( ) == backup_setting :: SECTION_LEVEL ) { $ this -> label = get_string... | Gets the label for this item |
31,867 | public function is_changeable ( $ level = null ) { if ( $ this -> setting -> get_status ( ) === backup_setting :: NOT_LOCKED ) { return true ; } else if ( $ this -> setting -> get_status ( ) !== backup_setting :: LOCKED_BY_HIERARCHY ) { return false ; } else if ( $ this -> setting -> has_dependencies_on_settings ( ) ) ... | Returns true if the setting is changeable . |
31,868 | public function get_static_value ( ) { global $ OUTPUT ; if ( $ this -> get_value ( ) ) { return $ OUTPUT -> pix_icon ( 'i/valid' , get_string ( 'yes' ) ) ; } else { return $ OUTPUT -> pix_icon ( 'i/invalid' , get_string ( 'no' ) ) ; } } | Gets the static value for the element |
31,869 | public function is_changeable ( $ level = null ) { if ( $ this -> changeable === false ) { return false ; } else { return parent :: is_changeable ( $ level ) ; } } | Returns true if the setting is changeable |
31,870 | public function is_changeable ( $ level = null ) { if ( count ( $ this -> values ) == 1 ) { return false ; } else { return parent :: is_changeable ( $ level ) ; } } | Returns true if the setting is changeable false otherwise |
31,871 | public function addIdHandler ( $ id , $ pointer , $ obj = null ) { $ this -> idhandlers [ $ id ] = array ( $ pointer , $ obj ) ; } | Add ID Handler |
31,872 | public function disconnect ( ) { $ this -> log -> log ( "Disconnecting..." , XMPPHP_Log :: LEVEL_VERBOSE ) ; if ( false == ( bool ) $ this -> socket ) { return ; } $ this -> reconnect = false ; $ this -> send ( $ this -> stream_end ) ; $ this -> sent_disconnect = true ; $ this -> processUntil ( 'end_stream' , 5 ) ; $ t... | Disconnect from XMPP Host |
31,873 | private function __process ( $ maximum = 5 ) { $ remaining = $ maximum ; do { $ starttime = ( microtime ( true ) * 1000000 ) ; $ read = array ( $ this -> socket ) ; $ write = array ( ) ; $ except = array ( ) ; if ( is_null ( $ maximum ) ) { $ secs = NULL ; $ usecs = NULL ; } else if ( $ maximum == 0 ) { $ secs = 0 ; $ ... | Core reading tool 0 - > only read if data is immediately ready NULL - > wait forever and ever integer - > process for this amount of time |
31,874 | public function processTime ( $ timeout = NULL ) { if ( is_null ( $ timeout ) ) { return $ this -> __process ( NULL ) ; } else { return $ this -> __process ( $ timeout * 1000000 ) ; } } | Process until a timeout occurs |
31,875 | public function processUntil ( $ event , $ timeout = - 1 ) { $ start = time ( ) ; if ( ! is_array ( $ event ) ) $ event = array ( $ event ) ; $ this -> until [ ] = $ event ; end ( $ this -> until ) ; $ event_key = key ( $ this -> until ) ; reset ( $ this -> until ) ; $ this -> until_count [ $ event_key ] = 0 ; $ update... | Process until a specified event or a timeout occurs |
31,876 | public function setupParser ( ) { $ this -> parser = xml_parser_create ( 'UTF-8' ) ; xml_parser_set_option ( $ this -> parser , XML_OPTION_SKIP_WHITE , 1 ) ; xml_parser_set_option ( $ this -> parser , XML_OPTION_TARGET_ENCODING , 'UTF-8' ) ; xml_set_object ( $ this -> parser , $ this ) ; xml_set_element_handler ( $ thi... | Setup the XML parser |
31,877 | public function include_device_ajax ( ) { global $ PAGE , $ CFG ; $ config = new stdClass ( ) ; $ config -> resturl = '/message/output/airnotifier/rest.php' ; $ config -> pageparams = array ( ) ; $ PAGE -> requires -> yui_module ( 'moodle-message_airnotifier-toolboxes' , 'M.message.init_device_toolbox' , array ( array ... | Include the relevant javascript and language strings for the device toolbox YUI module |
31,878 | public function get_user_devices ( $ appname , $ userid = null ) { global $ USER , $ DB ; if ( empty ( $ userid ) ) { $ userid = $ USER -> id ; } $ devices = array ( ) ; $ params = array ( 'appid' => $ appname , 'userid' => $ userid ) ; $ userdevices = $ DB -> get_records ( 'user_devices' , $ params ) ; foreach ( $ use... | Return the user devices for a specific app . |
31,879 | public function request_accesskey ( ) { global $ CFG , $ USER ; require_once ( $ CFG -> libdir . '/filelib.php' ) ; $ serverurl = $ CFG -> airnotifierurl . ':' . $ CFG -> airnotifierport . '/accesskeys/' ; $ header = array ( 'Accept: application/json' , 'X-AN-APP-NAME: ' . $ CFG -> airnotifierappname , 'X-AN-APP-KEY: n... | Request and access key to Airnotifier |
31,880 | private function create_token ( $ token ) { global $ CFG ; if ( ! $ this -> is_system_configured ( ) ) { return false ; } require_once ( $ CFG -> libdir . '/filelib.php' ) ; $ serverurl = $ CFG -> airnotifierurl . ':' . $ CFG -> airnotifierport . '/tokens/' . $ token ; $ header = array ( 'Accept: application/json' , 'X... | Create a device token in the Airnotifier instance |
31,881 | public function definition_after_data ( ) { parent :: definition_after_data ( ) ; $ this -> _form -> addRule ( 'setting_root_filename' , get_string ( 'errorfilenamerequired' , 'backup' ) , 'required' ) ; $ this -> _form -> setType ( 'setting_root_filename' , PARAM_FILE ) ; } | Adds the last elements rules settings etc to the form after data has been set . |
31,882 | public function validation ( $ data , $ files ) { $ errors = parent :: validation ( $ data , $ files ) ; if ( ! array_key_exists ( 'setting_root_filename' , $ errors ) ) { if ( trim ( $ data [ 'setting_root_filename' ] ) == '' ) { $ errors [ 'setting_root_filename' ] = get_string ( 'errorfilenamerequired' , 'backup' ) ... | Validates the form . |
31,883 | public function display_options ( ) { $ this -> display_category_form ( $ this -> contexts , $ this -> baseurl , $ this -> cat ) ; $ this -> print_category_info ( $ this -> category ) ; } | Called by question_bank_view to display the GUI for selecting a category |
31,884 | public function display_options_adv ( ) { echo \ html_writer :: start_div ( ) ; echo \ html_writer :: empty_tag ( 'input' , array ( 'type' => 'hidden' , 'name' => 'recurse' , 'value' => 0 , 'id' => 'recurse_off' ) ) ; echo \ html_writer :: checkbox ( 'recurse' , '1' , $ this -> recurse , get_string ( 'includesubcategor... | Displays the recursion checkbox GUI . question_bank_view places this within the section that is hidden by default |
31,885 | protected function display_category_form ( $ contexts , $ pageurl , $ current ) { echo \ html_writer :: start_div ( 'choosecategory' ) ; $ catmenu = question_category_options ( $ contexts , true , 0 , true ) ; echo \ html_writer :: label ( get_string ( 'selectacategory' , 'question' ) , 'id_selectacategory' ) ; echo \ ... | Display the drop down to select the category . |
31,886 | protected function get_current_category ( $ categoryandcontext ) { global $ DB , $ OUTPUT ; list ( $ categoryid , $ contextid ) = explode ( ',' , $ categoryandcontext ) ; if ( ! $ categoryid ) { $ this -> print_choose_category_message ( $ categoryandcontext ) ; return false ; } if ( ! $ category = $ DB -> get_record ( ... | Look up the category record based on cateogry ID and context |
31,887 | protected function print_category_info ( $ category ) { $ formatoptions = new \ stdClass ( ) ; $ formatoptions -> noclean = true ; $ formatoptions -> overflowdiv = true ; echo \ html_writer :: start_div ( 'boxaligncenter categoryinfo' ) ; if ( isset ( $ this -> maxinfolength ) ) { echo shorten_text ( format_text ( $ ca... | Print the category description |
31,888 | public function display ( $ templates ) { global $ OUTPUT ; if ( empty ( $ templates ) ) { echo $ OUTPUT -> box ( get_string ( 'no_templates_available_yet' , 'feedback' ) , 'generalbox boxaligncenter' ) ; return ; } $ this -> setup ( ) ; $ strdeletefeedback = get_string ( 'delete_template' , 'feedback' ) ; foreach ( $ ... | Displays the table with the given set of templates |
31,889 | public static function js ( $ content ) { try { $ minifier = new MatthiasMullie \ Minify \ JS ( $ content ) ; return $ minifier -> minify ( ) ; } catch ( Exception $ e ) { ob_end_clean ( ) ; $ error = $ e -> getMessage ( ) ; } $ return = <<<EODtry {console.log('Error: Minimisation of JavaScript failed!');} catch (e) {... | Minify JS code . |
31,890 | public static function js_files ( array $ files ) { if ( empty ( $ files ) ) { return '' ; } $ compressed = array ( ) ; foreach ( $ files as $ file ) { $ content = file_get_contents ( $ file ) ; if ( $ content === false ) { $ compressed [ ] = "\n\n// Cannot read JS file " . basename ( dirname ( dirname ( $ file ) ) ) .... | Minify JS files . |
31,891 | public static function css ( $ content ) { $ error = 'unknown' ; try { $ minifier = new MatthiasMullie \ Minify \ CSS ( $ content ) ; return $ minifier -> minify ( ) ; } catch ( Exception $ e ) { $ error = $ e -> getMessage ( ) ; } $ return = <<<EOD/* Error: $error *//* Problem detected during CSS minimisation, please... | Minify CSS code . |
31,892 | public static function css_files ( array $ files ) { if ( empty ( $ files ) ) { return '' ; } $ compressed = array ( ) ; foreach ( $ files as $ file ) { $ content = file_get_contents ( $ file ) ; if ( $ content === false ) { $ compressed [ ] = "\n\n/* Cannot read CSS file " . basename ( dirname ( dirname ( $ file ) ) )... | Minify CSS files . |
31,893 | public function display_data ( ) { $ data = parent :: display_data ( ) ; if ( ! empty ( $ this -> field -> param4 ) and ! empty ( $ data ) ) { if ( ! empty ( $ this -> field -> param5 ) ) { $ target = 'target="' . $ this -> field -> param5 . '"' ; } else { $ target = '' ; } $ data = '<a href="' . str_replace ( '$$' , u... | Overwrite the base class to display the data for this field |
31,894 | public function edit_field_add ( $ mform ) { $ size = $ this -> field -> param1 ; $ maxlength = $ this -> field -> param2 ; $ fieldtype = ( $ this -> field -> param3 == 1 ? 'password' : 'text' ) ; $ mform -> addElement ( $ fieldtype , $ this -> inputname , format_string ( $ this -> field -> name ) , 'maxlength="' . $ m... | Add fields for editing a text profile field . |
31,895 | public function sanitize ( ) { if ( ! $ this -> _sanitized ) { foreach ( array_keys ( $ this -> _vars ) as $ key ) { $ this -> $ key = $ this -> filter ( $ key ) ; } $ this -> _sanitized = true ; } } | Sanitize the form input . |
31,896 | public function get ( $ varname , $ default = null ) { return $ this -> _getExists ( $ this -> _vars , $ varname , $ value ) ? $ value : $ default ; } | Returns the value of a given form variable . |
31,897 | public function getExists ( $ varname , & $ exists ) { $ exists = $ this -> _getExists ( $ this -> _vars , $ varname , $ value ) ; return $ value ; } | Given a variable name returns the value and sets a variable indicating whether the value exists in the form data . |
31,898 | public function filter ( $ varname ) { $ val = $ this -> $ varname ; if ( is_null ( $ val ) || $ this -> _sanitized ) { return $ val ; } return is_array ( $ val ) ? filter_var_array ( $ val , FILTER_SANITIZE_STRING ) : filter_var ( $ val , FILTER_SANITIZE_STRING ) ; } | Filters a form value so that it can be used in HTML output . |
31,899 | public function execute ( ) { global $ CFG , $ DB ; $ timenow = time ( ) ; $ weekago = $ timenow - ( 7 * 24 * 3600 ) ; $ this -> log_start ( "Removing old digest records from 7 days ago." ) ; $ DB -> delete_records_select ( 'forum_queue' , "timemodified < ?" , array ( $ weekago ) ) ; $ this -> log_finish ( "Removed all... | Execute the scheduled task . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.