idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
7,100 | public static function getPicklistFacts ( $ fact_type ) : array { switch ( $ fact_type ) { case 'INDI' : $ tags = [ 'RESN' , 'NAME' , 'SEX' , 'BIRT' , 'CHR' , 'DEAT' , 'BURI' , 'CREM' , 'ADOP' , 'BAPM' , 'BARM' , 'BASM' , 'BLES' , 'CHRA' , 'CONF' , 'FCOM' , 'ORDN' , 'NATU' , 'EMIG' , 'IMMI' , 'CENS' , 'PROB' , 'WILL' ,... | Get a list of facts for use in the fact picker edit control |
7,101 | public static function createUid ( ) : string { $ uid = str_replace ( '-' , '' , Uuid :: uuid4 ( ) -> toString ( ) ) ; $ checksum_a = 0 ; $ checksum_b = 0 ; for ( $ i = 0 ; $ i < 32 ; $ i += 2 ) { $ checksum_a += hexdec ( substr ( $ uid , $ i , 2 ) ) ; $ checksum_b += $ checksum_a & 0xff ; } return strtoupper ( $ uid .... | Generate a value for a new _UID field . Instead of RFC4122 - compatible UUIDs generate ones that are compatible with PAF Legacy RootsMagic etc . In these the string is upper - cased dashes are removed and a two - byte checksum is added . |
7,102 | public function controlPanelManager ( ModuleService $ module_service ) : ResponseInterface { $ all_trees = array_filter ( Tree :: getAll ( ) , static function ( Tree $ tree ) : bool { return Auth :: isManager ( $ tree ) ; } ) ; return $ this -> viewResponse ( 'admin/control-panel-manager' , [ 'title' => I18N :: transla... | Managers see a restricted version of the contol panel . |
7,103 | private function totalChanges ( ) : array { return DB :: table ( 'gedcom' ) -> leftJoin ( 'change' , static function ( JoinClause $ join ) : void { $ join -> on ( 'change.gedcom_id' , '=' , 'gedcom.gedcom_id' ) -> where ( 'change.status' , '=' , 'pending' ) ; } ) -> groupBy ( 'gedcom.gedcom_id' ) -> pluck ( DB :: raw (... | Count the number of pending changes in each tree . |
7,104 | private function totalFamilies ( ) : Collection { return DB :: table ( 'gedcom' ) -> leftJoin ( 'families' , 'f_file' , '=' , 'gedcom_id' ) -> groupBy ( 'gedcom_id' ) -> pluck ( DB :: raw ( 'COUNT(f_id)' ) , 'gedcom_id' ) -> map ( static function ( string $ count ) { return ( int ) $ count ; } ) ; } | Count the number of families in each tree . |
7,105 | private function totalNotes ( ) : Collection { return DB :: table ( 'gedcom' ) -> leftJoin ( 'other' , static function ( JoinClause $ join ) : void { $ join -> on ( 'o_file' , '=' , 'gedcom_id' ) -> where ( 'o_type' , '=' , 'NOTE' ) ; } ) -> groupBy ( 'gedcom_id' ) -> pluck ( DB :: raw ( 'COUNT(o_id)' ) , 'gedcom_id' )... | Count the number of notes in each tree . |
7,106 | protected function nameAtCensusDate ( Individual $ individual , Date $ census_date ) : array { $ names = $ individual -> getAllNames ( ) ; $ name = $ names [ 0 ] ; foreach ( $ individual -> spouseFamilies ( ) as $ family ) { foreach ( $ family -> facts ( [ 'MARR' ] ) as $ marriage ) { if ( $ marriage -> date ( ) -> isO... | What was an individual s likely name on a given date allowing for marriages and married names . |
7,107 | public static function create ( $ name ) : SurnameTraditionInterface { switch ( $ name ) { case 'paternal' : return new PaternalSurnameTradition ( ) ; case 'patrilineal' : return new PatrilinealSurnameTradition ( ) ; case 'matrilineal' : return new MatrilinealSurnameTradition ( ) ; case 'portuguese' : return new Portug... | Create a surname tradition object for a given surname tradition name . |
7,108 | public static function addConfigurationLog ( $ message , Tree $ tree = null ) : void { self :: addLog ( $ message , self :: TYPE_CONFIGURATION , $ tree ) ; } | Store a configuration message in the message log . |
7,109 | public static function addEditLog ( $ message , Tree $ tree ) : void { self :: addLog ( $ message , self :: TYPE_EDIT , $ tree ) ; } | Store an edit message in the message log . |
7,110 | public static function addSearchLog ( $ message , array $ trees ) : void { foreach ( $ trees as $ tree ) { self :: addLog ( $ message , self :: TYPE_SEARCH , $ tree ) ; } } | Store a search event in the message log . Unlike most webtrees activity search is not restricted to a single tree so we need to record which trees were searchecd . |
7,111 | final protected function getBlockSetting ( int $ block_id , string $ setting_name , string $ default = '' ) : string { $ settings = app ( 'cache.array' ) -> rememberForever ( 'block_setting' . $ block_id , static function ( ) use ( $ block_id ) : array { return DB :: table ( 'block_setting' ) -> where ( 'block_id' , '=... | Get a block setting . |
7,112 | final protected function setBlockSetting ( int $ block_id , string $ setting_name , string $ setting_value ) : self { DB :: table ( 'block_setting' ) -> updateOrInsert ( [ 'block_id' => $ block_id , 'setting_name' => $ setting_name , ] , [ 'setting_value' => $ setting_value , ] ) ; return $ this ; } | Set a block setting . |
7,113 | final public function getPreference ( string $ setting_name , string $ default = '' ) : string { return DB :: table ( 'module_setting' ) -> where ( 'module_name' , '=' , $ this -> name ( ) ) -> where ( 'setting_name' , '=' , $ setting_name ) -> value ( 'setting_value' ) ?? $ default ; } | Get a module setting . Return a default if the setting is not set . |
7,114 | final public function setPreference ( string $ setting_name , string $ setting_value ) : void { DB :: table ( 'module_setting' ) -> updateOrInsert ( [ 'module_name' => $ this -> name ( ) , 'setting_name' => $ setting_name , ] , [ 'setting_value' => $ setting_value , ] ) ; } | Set a module setting . |
7,115 | final public function accessLevel ( Tree $ tree , string $ interface ) : int { $ access_levels = app ( 'cache.array' ) -> rememberForever ( 'module_privacy' . $ tree -> id ( ) , static function ( ) use ( $ tree ) : Collection { return DB :: table ( 'module_privacy' ) -> where ( 'gedcom_id' , '=' , $ tree -> id ( ) ) ->... | Get a the current access level for a module |
7,116 | public function show ( ServerRequestInterface $ request , Tree $ tree , ClipboardService $ clipboard_service ) : ResponseInterface { $ xref = $ request -> get ( 'xref' , '' ) ; $ family = Family :: getInstance ( $ xref , $ tree ) ; Auth :: checkFamilyAccess ( $ family , false ) ; $ clipboard_facts = $ clipboard_service... | Show a family s page . |
7,117 | public static function fileUploadErrorText ( $ error_code ) : string { switch ( $ error_code ) { case UPLOAD_ERR_OK : return I18N :: translate ( 'File successfully uploaded' ) ; case UPLOAD_ERR_INI_SIZE : case UPLOAD_ERR_FORM_SIZE : return I18N :: translate ( 'The uploaded file exceeds the allowed size.' ) ; case UPLOA... | Convert a file upload PHP error code into user - friendly text . |
7,118 | public static function getSubRecord ( $ level , $ tag , $ gedrec , $ num = 1 ) : string { if ( empty ( $ gedrec ) ) { return '' ; } $ gedrec = "\n" . $ gedrec . "\n" ; $ tag = trim ( $ tag ) ; $ searchTarget = "~[\n]" . $ tag . "[\s]~" ; $ ct = preg_match_all ( $ searchTarget , $ gedrec , $ match , PREG_SET_ORDER | PRE... | get a gedcom subrecord |
7,119 | public static function getCont ( $ nlevel , $ nrec ) : string { $ text = '' ; $ subrecords = explode ( "\n" , $ nrec ) ; foreach ( $ subrecords as $ thisSubrecord ) { if ( substr ( $ thisSubrecord , 0 , 2 ) !== $ nlevel . ' ' ) { continue ; } $ subrecordType = substr ( $ thisSubrecord , 2 , 4 ) ; if ( $ subrecordType =... | get CONT lines |
7,120 | public static function getCloseRelationshipName ( Individual $ individual1 , Individual $ individual2 ) : string { if ( $ individual1 === $ individual2 ) { return self :: reflexivePronoun ( $ individual1 ) ; } try { $ relationship = self :: getRelationship ( $ individual1 , $ individual2 ) ; return self :: getRelations... | For close family relationships such as the families tab and the family navigator Display a tick if both individuals are the same . |
7,121 | private static function reflexivePronoun ( Individual $ individual ) : string { switch ( $ individual -> sex ( ) ) { case 'M' : return I18N :: translate ( 'himself' ) ; case 'F' : return I18N :: translate ( 'herself' ) ; default : return I18N :: translate ( 'themself' ) ; } } | Generate a reflexive pronoun for an individual |
7,122 | public function deleteFact ( ServerRequestInterface $ request , Tree $ tree ) : ResponseInterface { $ xref = $ request -> get ( 'xref' , '' ) ; $ fact_id = $ request -> get ( 'fact_id' ) ; $ record = GedcomRecord :: getInstance ( $ xref , $ tree ) ; Auth :: checkRecordAccess ( $ record , true ) ; foreach ( $ record -> ... | Delete a fact . |
7,123 | public function pasteFact ( ServerRequestInterface $ request , Tree $ tree , ClipboardService $ clipboard_service ) : ResponseInterface { $ xref = $ request -> get ( 'xref' , '' ) ; $ fact_id = $ request -> get ( 'fact_id' ) ; $ record = GedcomRecord :: getInstance ( $ xref , $ tree ) ; Auth :: checkRecordAccess ( $ re... | Paste a fact from the clipboard into a record . |
7,124 | private function totalMediaTypeQuery ( string $ type ) : int { if ( ( $ type !== self :: MEDIA_TYPE_ALL ) && ( $ type !== self :: MEDIA_TYPE_UNKNOWN ) && ! in_array ( $ type , self :: MEDIA_TYPES , true ) ) { return 0 ; } $ query = DB :: table ( 'media' ) -> where ( 'm_file' , '=' , $ this -> tree -> id ( ) ) ; if ( $ ... | Returns the number of media records of the given type . |
7,125 | private function getSortedMediaTypeList ( int $ tot ) : array { $ media = [ ] ; $ c = 0 ; $ max = 0 ; foreach ( self :: MEDIA_TYPES as $ type ) { $ count = $ this -> totalMediaTypeQuery ( $ type ) ; if ( $ count > 0 ) { $ media [ $ type ] = $ count ; if ( $ count > $ max ) { $ max = $ count ; } $ c += $ count ; } } $ c... | Returns a sorted list of media types and their total counts . |
7,126 | private function formatSexRecord ( Fact $ fact ) : string { $ individual = $ fact -> record ( ) ; switch ( $ fact -> value ( ) ) { case 'M' : $ sex = I18N :: translate ( 'Male' ) ; break ; case 'F' : $ sex = I18N :: translate ( 'Female' ) ; break ; default : $ sex = I18N :: translateContext ( 'unknown gender' , 'Unknow... | print information for a sex record |
7,127 | public function getWidth ( $ renderer ) { if ( $ renderer -> getCurrentStyle ( ) != $ this -> styleName ) { $ renderer -> setCurrentStyle ( $ this -> styleName ) ; } $ fsize = $ renderer -> getCurrentStyleHeight ( ) ; if ( $ fsize > $ renderer -> largestFontHeight ) { $ renderer -> largestFontHeight = $ fsize ; } $ lw ... | Get the width of text and wrap it too |
7,128 | public function isTimeNearlyUp ( float $ threshold = self :: TIME_UP_THRESHOLD ) : bool { $ max_execution_time = ( int ) ini_get ( 'max_execution_time' ) ; if ( $ max_execution_time === 0 ) { return false ; } $ now = microtime ( true ) ; return $ now + $ threshold > $ this -> start_time + ( float ) $ max_execution_time... | Some long - running scripts need to know when to stop . |
7,129 | public function isTimeLimitUp ( float $ limit = self :: TIME_LIMIT ) : bool { $ now = microtime ( true ) ; return $ now > $ this -> start_time + $ limit ; } | Some long running scripts are broken down into small chunks . |
7,130 | public static function activeLocales ( ) : array { $ locales = app ( ModuleService :: class ) -> findByInterface ( ModuleLanguageInterface :: class , false , true ) -> map ( static function ( ModuleLanguageInterface $ module ) : LocaleInterface { return $ module -> locale ( ) ; } ) ; if ( $ locales -> isEmpty ( ) ) { r... | The preferred locales for this site or a default list if no preference . |
7,131 | public static function installedLocales ( ) : Collection { return app ( ModuleService :: class ) -> findByInterface ( ModuleLanguageInterface :: class , true ) -> map ( static function ( ModuleLanguageInterface $ module ) : LocaleInterface { return $ module -> locale ( ) ; } ) ; } | All locales for which a translation file exists . |
7,132 | public static function strcasecmp ( $ string1 , $ string2 ) : int { if ( self :: $ collator instanceof Collator ) { return self :: $ collator -> compare ( $ string1 , $ string2 ) ; } return strcmp ( self :: strtolower ( $ string1 ) , self :: strtolower ( $ string2 ) ) ; } | Perform a case - insensitive comparison of two strings . |
7,133 | public static function strtolower ( $ string ) : string { if ( in_array ( self :: $ locale -> language ( ) -> code ( ) , self :: DOTLESS_I_LOCALES , true ) ) { $ string = strtr ( $ string , self :: DOTLESS_I_TOLOWER ) ; } return mb_strtolower ( $ string ) ; } | Convert a string to lower case . |
7,134 | public static function strtoupper ( $ string ) : string { if ( in_array ( self :: $ locale -> language ( ) -> code ( ) , self :: DOTLESS_I_LOCALES , true ) ) { $ string = strtr ( $ string , self :: DOTLESS_I_TOUPPER ) ; } return mb_strtoupper ( $ string ) ; } | Convert a string to upper case . |
7,135 | public static function textScript ( $ string ) : string { $ string = strip_tags ( $ string ) ; $ string = html_entity_decode ( $ string , ENT_QUOTES , 'UTF-8' ) ; $ string = str_replace ( [ '@N.N.' , '@P.N.' , ] , '' , $ string ) ; $ pos = 0 ; $ strlen = strlen ( $ string ) ; while ( $ pos < $ strlen ) { $ byte1 = ord ... | Identify the script used for a piece of text |
7,136 | public function find ( $ user_id ) : ? User { return app ( 'cache.array' ) -> rememberForever ( __CLASS__ . $ user_id , static function ( ) use ( $ user_id ) : ? User { return DB :: table ( 'user' ) -> where ( 'user_id' , '=' , $ user_id ) -> get ( ) -> map ( User :: rowMapper ( ) ) -> first ( ) ; } ) ; } | Find the user with a specified user_id . |
7,137 | public function findByEmail ( $ email ) : ? User { return DB :: table ( 'user' ) -> where ( 'email' , '=' , $ email ) -> get ( ) -> map ( User :: rowMapper ( ) ) -> first ( ) ; } | Find the user with a specified email address . |
7,138 | public function findByIdentifier ( $ identifier ) : ? User { return DB :: table ( 'user' ) -> where ( 'user_name' , '=' , $ identifier ) -> orWhere ( 'email' , '=' , $ identifier ) -> get ( ) -> map ( User :: rowMapper ( ) ) -> first ( ) ; } | Find the user with a specified user_name or email address . |
7,139 | public function findByUserName ( $ user_name ) : ? User { return DB :: table ( 'user' ) -> where ( 'user_name' , '=' , $ user_name ) -> get ( ) -> map ( User :: rowMapper ( ) ) -> first ( ) ; } | Find the user with a specified user_name . |
7,140 | public function administrators ( ) : Collection { return DB :: table ( 'user' ) -> join ( 'user_setting' , static function ( JoinClause $ join ) : void { $ join -> on ( 'user_setting.user_id' , '=' , 'user.user_id' ) -> where ( 'user_setting.setting_name' , '=' , 'canadmin' ) -> where ( 'user_setting.setting_value' , '... | Get a list of all administrators . |
7,141 | public function allLoggedIn ( ) : Collection { return DB :: table ( 'user' ) -> join ( 'session' , 'session.user_id' , '=' , 'user.user_id' ) -> where ( 'user.user_id' , '>' , 0 ) -> orderBy ( 'real_name' ) -> select ( [ 'user.*' ] ) -> distinct ( ) -> get ( ) -> map ( User :: rowMapper ( ) ) ; } | Get a list of all users who are currently logged in . |
7,142 | public function create ( string $ user_name , string $ real_name , string $ email , string $ password ) : User { DB :: table ( 'user' ) -> insert ( [ 'user_name' => $ user_name , 'real_name' => $ real_name , 'email' => $ email , 'password' => password_hash ( $ password , PASSWORD_DEFAULT ) , ] ) ; $ user_id = ( int ) D... | Create a new user . The calling code needs to check for duplicates identifiers before calling this function . |
7,143 | public function statsPlaces ( string $ what = 'ALL' , string $ fact = '' , int $ parent = 0 , bool $ country = false ) : array { if ( $ fact ) { return $ this -> queryFactPlaces ( $ fact , $ what , $ country ) ; } $ query = DB :: table ( 'places' ) -> join ( 'placelinks' , static function ( JoinClause $ join ) : void {... | Query places . |
7,144 | private function getTop10Places ( array $ places ) : array { $ top10 = [ ] ; $ i = 0 ; arsort ( $ places ) ; foreach ( $ places as $ place => $ count ) { $ tmp = new Place ( $ place , $ this -> tree ) ; $ top10 [ ] = [ 'place' => $ tmp , 'count' => $ count , ] ; ++ $ i ; if ( $ i === 10 ) { break ; } } return $ top10 ;... | Get the top 10 places list . |
7,145 | public function commonCountriesList ( ) : string { $ countries = $ this -> statsPlaces ( ) ; if ( empty ( $ countries ) ) { return '' ; } $ top10 = [ ] ; $ i = 1 ; $ country_names = [ ] ; foreach ( I18N :: activeLocales ( ) as $ locale ) { I18N :: init ( $ locale -> languageTag ( ) ) ; $ all_countries = $ this -> count... | A list of common countries . |
7,146 | public function setup ( ) : void { $ this -> rtl = I18N :: direction ( ) === 'rtl' ; $ this -> rkeywords = '' ; $ this -> generated_by = I18N :: translate ( 'Generated by %s' , Webtrees :: NAME . ' ' . Webtrees :: VERSION ) ; [ $ this -> page_width , $ this -> page_height ] = self :: PAPER_SIZES [ $ this -> page_format... | Initial Setup Setting up document wide defaults that will be inherited of the report modules As DEFAULT A4 and Portrait will be used if not set |
7,147 | public function getStyle ( string $ s ) : array { if ( ! isset ( $ this -> styles [ $ s ] ) ) { return current ( $ this -> styles ) ; } return $ this -> styles [ $ s ] ; } | Get a style from the Styles array |
7,148 | public function process ( ServerRequestInterface $ request , RequestHandlerInterface $ handler ) : ResponseInterface { $ this -> migration_service -> updateSchema ( '\Fisharebest\Webtrees\Schema' , 'WT_SCHEMA_VERSION' , Webtrees :: SCHEMA_VERSION ) ; return $ handler -> handle ( $ request ) ; } | Update the database schema if necessary . |
7,149 | public function cleanData ( ServerRequestInterface $ request , FilesystemInterface $ filesystem ) : ResponseInterface { $ protected = [ '.htaccess' , '.gitignore' , 'index.php' , 'config.ini.php' , ] ; if ( $ request -> getAttribute ( 'dbtype' ) === 'sqlite' ) { $ protected [ ] = $ request -> getAttribute ( 'dbname' ) ... | Show old user files in the data folder . |
7,150 | public function cleanDataAction ( ServerRequestInterface $ request , FilesystemInterface $ filesystem ) : ResponseInterface { $ to_delete = ( array ) $ request -> get ( 'to_delete' ) ; $ to_delete = array_filter ( $ to_delete ) ; foreach ( $ to_delete as $ path ) { $ metadata = $ filesystem -> getMetadata ( $ path ) ; ... | Delete old user files in the data folder . |
7,151 | private function logsQuery ( ServerRequestInterface $ request ) : Builder { $ from = $ request -> get ( 'from' ) ; $ to = $ request -> get ( 'to' ) ; $ type = $ request -> get ( 'type' , '' ) ; $ text = $ request -> get ( 'text' , '' ) ; $ ip = $ request -> get ( 'ip' , '' ) ; $ username = $ request -> get ( 'username'... | Generate a query for filtering the site log . |
7,152 | public function serverInformation ( ) : ResponseInterface { ob_start ( ) ; phpinfo ( INFO_ALL & ~ INFO_CREDITS & ~ INFO_LICENSE ) ; $ phpinfo = ob_get_clean ( ) ; preg_match ( '%<body>(.*)</body>%s' , $ phpinfo , $ matches ) ; $ phpinfo = $ matches [ 1 ] ; return $ this -> viewResponse ( 'admin/server-information' , [ ... | Show the server information page . |
7,153 | public function contactLinkTechnical ( User $ user ) : string { return I18N :: translate ( 'For technical support and information contact %s.' , $ this -> user_service -> contactLink ( $ user ) ) ; } | Create contact link for technical support . |
7,154 | public static function nameComparator ( ) : Closure { return static function ( GedcomRecord $ x , GedcomRecord $ y ) : int { if ( $ x -> canShowName ( ) ) { if ( $ y -> canShowName ( ) ) { return I18N :: strcasecmp ( $ x -> sortName ( ) , $ y -> sortName ( ) ) ; } return - 1 ; } if ( $ y -> canShowName ( ) ) { return 1... | A closure which will compare records by name . |
7,155 | public static function lastChangeComparator ( int $ direction = 1 ) : Closure { return static function ( GedcomRecord $ x , GedcomRecord $ y ) use ( $ direction ) : int { return $ direction * ( $ x -> lastChangeTimestamp ( ) <=> $ y -> lastChangeTimestamp ( ) ) ; } ; } | A closure which will compare records by change time . |
7,156 | private function parseFacts ( ) : void { if ( $ this -> gedcom ) { $ gedcom_facts = preg_split ( '/\n(?=1)/s' , $ this -> gedcom ) ; array_shift ( $ gedcom_facts ) ; } else { $ gedcom_facts = [ ] ; } if ( $ this -> pending ) { $ pending_facts = preg_split ( '/\n(?=1)/s' , $ this -> pending ) ; array_shift ( $ pending_f... | Split the record into facts |
7,157 | private function canShowRecord ( int $ access_level ) : bool { if ( ! $ this -> tree -> getPreference ( 'HIDE_LIVE_PEOPLE' ) ) { return true ; } if ( $ this -> xref ( ) === $ this -> tree -> getUserPreference ( Auth :: user ( ) , 'gedcomid' ) && $ access_level === Auth :: accessLevel ( $ this -> tree ) ) { return true ... | Work out whether this record can be shown to a user with a given access level |
7,158 | public function canShow ( int $ access_level = null ) : bool { $ access_level = $ access_level ?? Auth :: accessLevel ( $ this -> tree ) ; if ( $ access_level === Auth :: PRIV_HIDE ) { return true ; } $ cache_key = 'canShow' . $ this -> xref . ':' . $ this -> tree -> id ( ) . ':' . $ access_level ; return app ( 'cache.... | Can the details of this record be shown? |
7,159 | public function privatizeGedcom ( int $ access_level ) : string { if ( $ access_level === Auth :: PRIV_HIDE ) { return $ this -> gedcom ; } if ( $ this -> canShow ( $ access_level ) ) { [ $ gedrec ] = explode ( "\n" , $ this -> gedcom , 2 ) ; foreach ( $ this -> facts ( [ ] , false , $ access_level ) as $ fact ) { $ ge... | Remove private data from the raw gedcom record . Return both the visible and invisible data . We need the invisible data when editing . |
7,160 | public function alternateName ( ) : ? string { if ( $ this -> canShowName ( ) && $ this -> getPrimaryName ( ) !== $ this -> getSecondaryName ( ) ) { $ all_names = $ this -> getAllNames ( ) ; return $ all_names [ $ this -> getSecondaryName ( ) ] [ 'full' ] ; } return null ; } | Get the full name in an alternative character set |
7,161 | public function formatList ( ) : string { $ html = '<a href="' . e ( $ this -> url ( ) ) . '" class="list_item">' ; $ html .= '<b>' . $ this -> fullName ( ) . '</b>' ; $ html .= $ this -> formatListDetails ( ) ; $ html .= '</a>' ; return $ html ; } | Format this object for display in a list |
7,162 | public function linkedRepositories ( string $ link ) : array { $ rows = DB :: table ( 'other' ) -> join ( 'link' , static function ( JoinClause $ join ) : void { $ join -> on ( 'l_file' , '=' , 'o_file' ) -> on ( 'l_from' , '=' , 'o_id' ) ; } ) -> where ( 'o_file' , '=' , $ this -> tree -> id ( ) ) -> where ( 'o_type' ... | Find repositories linked to this record . |
7,163 | public function getAllEventPlaces ( array $ events ) : array { $ places = [ ] ; foreach ( $ this -> facts ( $ events ) as $ event ) { if ( preg_match_all ( '/\n(?:2 PLAC|3 (?:ROMN|FONE|_HEB)) +(.+)/' , $ event -> gedcom ( ) , $ ged_places ) ) { foreach ( $ ged_places [ 1 ] as $ ged_place ) { $ places [ ] = new Place ( ... | Get all the places for a particular type of event |
7,164 | public function facts ( array $ filter = [ ] , bool $ sort = false , int $ access_level = null , bool $ override = false ) : Collection { if ( $ access_level === null ) { $ access_level = Auth :: accessLevel ( $ this -> tree ) ; } $ facts = new Collection ( ) ; if ( $ this -> canShow ( $ access_level ) || $ override ) ... | The facts and events for this record . |
7,165 | public function lastChangeTimestamp ( ) : Carbon { $ chan = $ this -> facts ( [ 'CHAN' ] ) -> first ( ) ; if ( $ chan instanceof Fact ) { $ d = $ chan -> date ( ) -> minimumDate ( ) ; if ( preg_match ( '/\n3 TIME (\d\d):(\d\d):(\d\d)/' , $ chan -> gedcom ( ) , $ match ) ) { return Carbon :: create ( $ d -> year ( ) , $... | Get the last - change timestamp for this record |
7,166 | public function lastChangeUser ( ) : string { $ chan = $ this -> facts ( [ 'CHAN' ] ) -> first ( ) ; if ( $ chan === null ) { return I18N :: translate ( 'Unknown' ) ; } $ chan_user = $ chan -> attribute ( '_WT_USER' ) ; if ( $ chan_user === '' ) { return I18N :: translate ( 'Unknown' ) ; } return $ chan_user ; } | Get the last - change user for this record |
7,167 | public function createFact ( string $ gedcom , bool $ update_chan ) : void { $ this -> updateFact ( '' , $ gedcom , $ update_chan ) ; } | Add a new fact to this record |
7,168 | public function deleteFact ( string $ fact_id , bool $ update_chan ) : void { $ this -> updateFact ( $ fact_id , '' , $ update_chan ) ; } | Delete a fact from this record |
7,169 | public function updateFact ( string $ fact_id , string $ gedcom , bool $ update_chan ) : void { $ gedcom = preg_replace ( '/[\r\n]+/' , "\n" , $ gedcom ) ; $ gedcom = trim ( $ gedcom ) ; if ( $ this -> pending === '' ) { throw new Exception ( 'Cannot edit a deleted record' ) ; } if ( $ gedcom !== '' && ! preg_match ( '... | Replace a fact with a new gedcom data . |
7,170 | public function updateRecord ( string $ gedcom , bool $ update_chan ) : void { $ gedcom = preg_replace ( '/[\r\n]+/' , "\n" , $ gedcom ) ; $ gedcom = trim ( $ gedcom ) ; if ( $ update_chan ) { $ gedcom = preg_replace ( '/\n1 CHAN(\n[2-9].*)*/' , '' , $ gedcom ) ; $ gedcom .= "\n1 CHAN\n2 DATE " . date ( 'd M Y' ) . "\n... | Update this record |
7,171 | public function linkingRecords ( ) : array { $ union = DB :: table ( 'change' ) -> where ( 'gedcom_id' , '=' , $ this -> tree ( ) -> id ( ) ) -> whereContains ( 'new_gedcom' , '@' . $ this -> xref ( ) . '@' ) -> where ( 'new_gedcom' , 'NOT LIKE' , '0 @' . $ this -> xref ( ) . '@%' ) -> select ( [ 'xref' ] ) ; $ xrefs =... | Fetch XREFs of all records linked to a record - when deleting an object we must also delete all links to it . |
7,172 | public function chartSex ( int $ tot_m , int $ tot_f , int $ tot_u , string $ color_female = null , string $ color_male = null , string $ color_unknown = null ) : string { $ color_female = $ color_female ?? '#ffd1dc' ; $ color_male = $ color_male ?? '#84beff' ; $ color_unknown = $ color_unknown ?? '#777777' ; $ data = ... | Generate a chart showing sex distribution . |
7,173 | public function createNoteObjectAction ( ServerRequestInterface $ request , Tree $ tree ) : ResponseInterface { $ note = $ request -> get ( 'note' , '' ) ; $ privacy_restriction = $ request -> get ( 'privacy-restriction' , '' ) ; $ edit_restriction = $ request -> get ( 'edit-restriction' , '' ) ; $ note = preg_replace ... | Process a form to create a new note object . |
7,174 | private function allRecordsInCart ( Tree $ tree ) : array { $ cart = Session :: get ( 'cart' , [ ] ) ; $ xrefs = array_keys ( $ cart [ $ tree -> name ( ) ] ?? [ ] ) ; $ records = array_map ( static function ( string $ xref ) use ( $ tree ) : GedcomRecord { return GedcomRecord :: getInstance ( $ xref , $ tree ) ; } , $ ... | Get all the records in the cart . |
7,175 | private function addRecordToCart ( GedcomRecord $ record ) : void { $ cart = Session :: get ( 'cart' , [ ] ) ; $ tree_name = $ record -> tree ( ) -> name ( ) ; $ cart [ $ tree_name ] [ $ record -> xref ( ) ] = true ; preg_match_all ( '/\n\d (?:OBJE|NOTE|SOUR|REPO) @(' . Gedcom :: REGEX_XREF . ')@/' , $ record -> gedcom... | Add a record ( and direclty linked sources notes etc . to the cart . |
7,176 | private function allAncestors ( $ xref1 , $ xref2 , $ tree_id ) : array { $ ancestors = [ $ xref1 , $ xref2 , ] ; $ queue = [ $ xref1 , $ xref2 , ] ; while ( ! empty ( $ queue ) ) { $ parents = DB :: table ( 'link AS l1' ) -> join ( 'link AS l2' , static function ( JoinClause $ join ) : void { $ join -> on ( 'l1.l_to' ... | Find all ancestors of a list of individuals |
7,177 | private function excludeFamilies ( $ xref1 , $ xref2 , $ tree_id ) : array { return DB :: table ( 'link AS l1' ) -> join ( 'link AS l2' , static function ( JoinClause $ join ) : void { $ join -> on ( 'l1.l_to' , '=' , 'l2.l_to' ) -> on ( 'l1.l_type' , '=' , 'l2.l_type' ) -> on ( 'l1.l_file' , '=' , 'l2.l_file' ) ; } ) ... | Find all families of two individuals |
7,178 | public function extractWebtreesZip ( string $ zip_file , string $ target_folder ) : void { $ zip = new ZipArchive ( ) ; if ( $ zip -> open ( $ zip_file ) ) { $ zip -> extractTo ( $ target_folder ) ; $ zip -> close ( ) ; } else { throw new InternalServerErrorException ( 'Cannot read ZIP file. Is it corrupt?' ) ; } } | Unpack webtrees . zip . |
7,179 | public function webtreesZipContents ( string $ zip_file ) : Collection { $ zip_adapter = new ZipArchiveAdapter ( $ zip_file , null , 'webtrees' ) ; $ zip_filesystem = new Filesystem ( new CachedAdapter ( $ zip_adapter , new Memory ( ) ) ) ; $ paths = new Collection ( $ zip_filesystem -> listContents ( '' , true ) ) ; r... | Create a list of all the files in a webtrees . ZIP archive |
7,180 | protected function chart ( Individual $ individual , int $ generations , bool $ show_spouse ) : ResponseInterface { $ this -> layout = 'layouts/ajax' ; return $ this -> viewResponse ( 'modules/hourglass-chart/chart' , [ 'generations' => $ generations , 'individual' => $ individual , 'show_spouse' => $ show_spouse , ] )... | Generate the initial generations of the chart |
7,181 | public function setup ( ) : void { parent :: setup ( ) ; if ( $ this -> orientation === 'landscape' ) { $ tmpw = $ this -> page_width ; $ this -> page_width = $ this -> page_height ; $ this -> page_height = $ tmpw ; } $ this -> noMarginWidth = $ this -> page_width - $ this -> left_margin - $ this -> right_margin ; if (... | HTML Setup - ReportHtml |
7,182 | private function runPageHeader ( ) { foreach ( $ this -> pageHeaderElements as $ element ) { if ( $ element instanceof ReportBaseElement ) { $ element -> render ( $ this ) ; } elseif ( $ element === 'footnotetexts' ) { $ this -> footnotes ( ) ; } elseif ( $ element === 'addpage' ) { $ this -> addPage ( ) ; } } } | Generate the page header |
7,183 | public function createCell ( $ width , $ height , $ border , $ align , $ bgcolor , $ style , $ ln , $ top , $ left , $ fill , $ stretch , $ bocolor , $ tcolor , $ reseth ) : ReportBaseCell { return new ReportHtmlCell ( $ width , $ height , $ border , $ align , $ bgcolor , $ style , $ ln , $ top , $ left , $ fill , $ st... | Create a new Cell object . |
7,184 | public function createTextBox ( float $ width , float $ height , bool $ border , string $ bgcolor , bool $ newline , float $ left , float $ top , bool $ pagecheck , string $ style , bool $ fill , bool $ padding , bool $ reseth ) : ReportBaseTextbox { return new ReportHtmlTextbox ( $ width , $ height , $ border , $ bgco... | Create a new TextBox object . |
7,185 | public function addPage ( ) { $ this -> pageN ++ ; $ this -> maxY += 10 ; if ( $ this -> maxY < $ this -> Y ) { $ this -> maxY = $ this -> Y ; } else { $ this -> Y = $ this -> maxY ; } } | Update the Page Number and set a new Y if max Y is larger - ReportHtml |
7,186 | public function checkFootnote ( ReportHtmlFootnote $ footnote ) { $ ct = count ( $ this -> printedfootnotes ) ; $ i = 0 ; $ val = $ footnote -> getValue ( ) ; while ( $ i < $ ct ) { if ( $ this -> printedfootnotes [ $ i ] -> getValue ( ) == $ val ) { $ footnote -> setNum ( $ i + 1 ) ; $ footnote -> setAddlink ( ( strin... | Checks the Footnote and numbers them - ReportHtml |
7,187 | public function getCurrentStyleHeight ( ) : float { if ( empty ( $ this -> currentStyle ) ) { return $ this -> default_font_size ; } $ style = $ this -> getStyle ( $ this -> currentStyle ) ; return $ style [ 'size' ] ; } | Get the current style height . |
7,188 | public function getFootnotesHeight ( float $ cellWidth ) : float { $ h = 0 ; foreach ( $ this -> printedfootnotes as $ element ) { $ h += $ element -> getFootnoteHeight ( $ this , $ cellWidth ) ; } return $ h ; } | Get the current footnotes height . |
7,189 | public function getStringWidth ( string $ text ) : float { $ style = $ this -> getStyle ( $ this -> currentStyle ) ; return mb_strlen ( $ text ) * ( $ style [ 'size' ] / 2 ) ; } | Get the width of a string . |
7,190 | public function getTextCellHeight ( string $ str ) : float { $ nl = $ this -> countLines ( $ str ) ; return ceil ( ( $ this -> getCurrentStyleHeight ( ) * $ this -> cellHeightRatio ) * $ nl ) ; } | Get a text height in points - ReportHtml |
7,191 | public function setY ( $ y ) { $ this -> Y = $ y ; if ( $ this -> maxY < $ y ) { $ this -> maxY = $ y ; } } | Set the Y position - ReportHtml |
7,192 | public function textWrap ( string $ str , float $ width ) : string { $ lw = ( int ) ( $ width / ( $ this -> getCurrentStyleHeight ( ) / 2 ) ) ; $ lines = explode ( "\n" , $ str ) ; $ lfct = count ( $ lines ) ; $ wraptext = '' ; foreach ( $ lines as $ line ) { $ wtext = FunctionsRtl :: utf8WordWrap ( $ line , $ lw , "\n... | Wrap text - ReportHtml |
7,193 | public function write ( $ text , $ color = '' , $ useclass = true ) { $ style = $ this -> getStyle ( $ this -> getCurrentStyle ( ) ) ; $ htmlcode = '<span dir="' . I18N :: direction ( ) . '"' ; if ( $ useclass ) { $ htmlcode .= ' class="' . $ style [ 'name' ] . '"' ; } if ( ! empty ( $ color ) ) { if ( preg_match ( '/#... | Write text - ReportHtml |
7,194 | public function step ( ServerRequestInterface $ request , ? Tree $ tree ) : ResponseInterface { $ step = $ request -> getQueryParams ( ) [ 'step' ] ?? self :: STEP_CHECK ; switch ( $ step ) { case self :: STEP_CHECK : return $ this -> wizardStepCheck ( ) ; case self :: STEP_PREPARE : return $ this -> wizardStepPrepare ... | Perform one step of the wizard |
7,195 | private function wizardStepPrepare ( ) : ResponseInterface { $ this -> filesystem -> deleteDir ( self :: UPGRADE_FOLDER ) ; $ this -> filesystem -> createDir ( self :: UPGRADE_FOLDER ) ; return response ( view ( 'components/alert-success' , [ 'alert' => I18N :: translate ( 'The folder %s has been created.' , e ( self :... | Make sure the temporary folder exists . |
7,196 | public static function addMessage ( $ text , $ status = 'info' ) : void { $ message = new stdClass ( ) ; $ message -> text = $ text ; $ message -> status = $ status ; $ messages = Session :: get ( self :: FLASH_KEY , [ ] ) ; $ messages [ ] = $ message ; Session :: put ( self :: FLASH_KEY , $ messages ) ; } | Add a message to the session storage . |
7,197 | public static function getMessages ( ) : array { $ messages = Session :: get ( self :: FLASH_KEY , [ ] ) ; Session :: forget ( self :: FLASH_KEY ) ; return $ messages ; } | Get the current messages and remove them from session storage . |
7,198 | public function deleteOldWebtreesFiles ( Filesystem $ filesystem ) : array { $ paths_to_delete = [ ] ; foreach ( self :: OLD_PATHS as $ path ) { if ( ! $ this -> deleteFileOrFolder ( $ filesystem , $ path ) ) { $ paths_to_delete [ ] = $ path ; } } return $ paths_to_delete ; } | Delete files and folders that belonged to an earlier version of webtrees . Return a list of those that we could not delete . |
7,199 | public function deleteOldFiles ( Filesystem $ filesystem , string $ path , int $ max_age ) : void { $ list = $ filesystem -> listContents ( $ path , true ) ; $ timestamp = Carbon :: now ( ) -> unix ( ) ; foreach ( $ list as $ metadata ) { if ( $ metadata [ 'timestamp' ] ?? $ timestamp < $ timestamp - $ max_age ) { $ th... | Delete old cache files . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.