idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
6,900 | private function loadSeedsFrom ( ) { if ( config ( 'roles.defaultSeeds.PermissionsTableSeeder' ) ) { $ this -> app [ 'seed.handler' ] -> register ( DefaultPermissionsTableSeeder :: class ) ; } if ( config ( 'roles.defaultSeeds.RolesTableSeeder' ) ) { $ this -> app [ 'seed.handler' ] -> register ( DefaultRolesTableSeede... | Loads a seeds . |
6,901 | public function hasOneRole ( $ role ) { foreach ( $ this -> getArrayFrom ( $ role ) as $ role ) { if ( $ this -> checkRole ( $ role ) ) { return true ; } } return false ; } | Check if the user has at least one of the given roles . |
6,902 | public function checkRole ( $ role ) { return $ this -> getRoles ( ) -> contains ( function ( $ value ) use ( $ role ) { return $ role == $ value -> id || Str :: is ( $ role , $ value -> slug ) ; } ) ; } | Check if the user has role . |
6,903 | public function hasOnePermission ( $ permission ) { foreach ( $ this -> getArrayFrom ( $ permission ) as $ permission ) { if ( $ this -> checkPermission ( $ permission ) ) { return true ; } } return false ; } | Check if the user has at least one of the given permissions . |
6,904 | public function allowed ( $ providedPermission , Model $ entity , $ owner = true , $ ownerColumn = 'user_id' ) { if ( $ this -> isPretendEnabled ( ) ) { return $ this -> pretend ( 'allowed' ) ; } if ( $ owner === true && $ entity -> { $ ownerColumn } == $ this -> id ) { return true ; } return $ this -> isAllowed ( $ pr... | Check if the user is allowed to manipulate with entity . |
6,905 | protected function isAllowed ( $ providedPermission , Model $ entity ) { foreach ( $ this -> getPermissions ( ) as $ permission ) { if ( $ permission -> model != '' && get_class ( $ entity ) == $ permission -> model && ( $ permission -> id == $ providedPermission || $ permission -> slug === $ providedPermission ) ) { r... | Check if the user is allowed to manipulate with provided entity . |
6,906 | public function attachPermission ( $ permission ) { return ( ! $ this -> permissions ( ) -> get ( ) -> contains ( $ permission ) ) ? $ this -> permissions ( ) -> attach ( $ permission ) : true ; } | Attach permission to a role . |
6,907 | private function buildBaseString ( $ baseURI , $ method , $ params ) { $ return = array ( ) ; ksort ( $ params ) ; foreach ( $ params as $ key => $ value ) { $ return [ ] = rawurlencode ( $ key ) . '=' . rawurlencode ( $ value ) ; } return $ method . "&" . rawurlencode ( $ baseURI ) . '&' . rawurlencode ( implode ( '&'... | Private method to generate the base string used by cURL |
6,908 | public function request ( $ url , $ method = 'get' , $ data = null , $ curlOptions = array ( ) ) { if ( strtolower ( $ method ) === 'get' ) { $ this -> setGetfield ( $ data ) ; } else { $ this -> setPostfields ( $ data ) ; } return $ this -> buildOauth ( $ url , $ method ) -> performRequest ( true , $ curlOptions ) ; } | Helper method to perform our request |
6,909 | protected function buildWifiString ( ) { $ wifi = $ this -> prefix ; if ( isset ( $ this -> encryption ) ) { $ wifi .= 'T:' . $ this -> encryption . $ this -> separator ; } if ( isset ( $ this -> ssid ) ) { $ wifi .= 'S:' . $ this -> ssid . $ this -> separator ; } if ( isset ( $ this -> password ) ) { $ wifi .= 'P:' . ... | Builds the WiFi string . |
6,910 | protected function setProperties ( array $ arguments ) { $ arguments = $ arguments [ 0 ] ; if ( isset ( $ arguments [ 'encryption' ] ) ) { $ this -> encryption = $ arguments [ 'encryption' ] ; } if ( isset ( $ arguments [ 'ssid' ] ) ) { $ this -> ssid = $ arguments [ 'ssid' ] ; } if ( isset ( $ arguments [ 'password' ]... | Sets the WiFi properties . |
6,911 | protected function setProperties ( array $ arguments ) { if ( isset ( $ arguments [ 0 ] ) ) { $ this -> phoneNumber = $ arguments [ 0 ] ; } if ( isset ( $ arguments [ 1 ] ) ) { $ this -> message = $ arguments [ 1 ] ; } } | Sets the phone number and message for a sms message . |
6,912 | protected function buildSMSString ( ) { $ sms = $ this -> prefix . $ this -> phoneNumber ; if ( isset ( $ this -> message ) ) { $ sms .= $ this -> separator . $ this -> message ; } return $ sms ; } | Builds a SMS string . |
6,913 | protected function setProperties ( array $ arguments ) { if ( isset ( $ arguments [ 0 ] ) ) { $ this -> address = $ arguments [ 0 ] ; } if ( isset ( $ arguments [ 1 ] ) ) { $ this -> amount = $ arguments [ 1 ] ; } if ( isset ( $ arguments [ 2 ] ) ) { $ this -> setOptions ( $ arguments [ 2 ] ) ; } } | Sets the BitCoin arguments . |
6,914 | protected function setOptions ( array $ options ) { if ( isset ( $ options [ 'label' ] ) ) { $ this -> label = $ options [ 'label' ] ; } if ( isset ( $ options [ 'message' ] ) ) { $ this -> message = $ options [ 'message' ] ; } if ( isset ( $ options [ 'returnAddress' ] ) ) { $ this -> returnAddress = $ options [ 'retu... | Sets the optional BitCoin options . |
6,915 | protected function buildBitCoinString ( ) { $ query = http_build_query ( [ 'amount' => $ this -> amount , 'label' => $ this -> label , '$message' => $ this -> message , 'r' => $ this -> returnAddress , ] ) ; $ btc = $ this -> prefix . $ this -> address . '?' . $ query ; return $ btc ; } | Builds a BitCoin string . |
6,916 | public function merge ( $ percentage ) { $ this -> setProperties ( $ percentage ) ; imagecopyresampled ( $ this -> sourceImage -> getImageResource ( ) , $ this -> mergeImage -> getImageResource ( ) , $ this -> centerX , $ this -> centerY , 0 , 0 , $ this -> postMergeImageWidth , $ this -> postMergeImageHeight , $ this ... | Returns an QrCode that has been merge with another image . This is usually used with logos to imprint a logo into a QrCode . |
6,917 | private function calculateCenter ( ) { $ this -> centerY = ( $ this -> sourceImageHeight / 2 ) - ( $ this -> postMergeImageHeight / 2 ) ; $ this -> centerX = ( $ this -> sourceImageWidth / 2 ) - ( $ this -> postMergeImageHeight / 2 ) ; } | Calculates the center of the source Image using the Merge image . |
6,918 | private function calculateOverlap ( $ percentage ) { $ this -> postMergeImageHeight = $ this -> sourceImageHeight * $ percentage ; $ this -> postMergeImageWidth = $ this -> sourceImageWidth * $ percentage ; } | Calculates the width of the merge image being placed on the source image . |
6,919 | public function generate ( $ text , $ filename = null ) { $ qrCode = $ this -> writer -> writeString ( $ text , $ this -> encoding , $ this -> errorCorrection ) ; if ( $ this -> imageMerge !== null ) { $ merger = new ImageMerge ( new Image ( $ qrCode ) , new Image ( $ this -> imageMerge ) ) ; $ qrCode = $ merger -> mer... | Generates a QrCode . |
6,920 | public function merge ( $ filepath , $ percentage = .2 , $ absolute = false ) { if ( function_exists ( 'base_path' ) && ! $ absolute ) { $ filepath = base_path ( ) . $ filepath ; } $ this -> imageMerge = file_get_contents ( $ filepath ) ; $ this -> imagePercentage = $ percentage ; return $ this ; } | Merges an image with the center of the QrCode . |
6,921 | public function mergeString ( $ content , $ percentage = .2 ) { $ this -> imageMerge = $ content ; $ this -> imagePercentage = $ percentage ; return $ this ; } | Merges an image string with the center of the QrCode does not check for correct format . |
6,922 | public function format ( $ format ) { switch ( $ format ) { case 'png' : $ this -> writer -> setRenderer ( new Png ( ) ) ; break ; case 'eps' : $ this -> writer -> setRenderer ( new Eps ( ) ) ; break ; case 'svg' : $ this -> writer -> setRenderer ( new Svg ( ) ) ; break ; default : throw new \ InvalidArgumentException ... | Switches the format of the outputted QrCode or defaults to SVG . |
6,923 | public function size ( $ pixels ) { $ this -> writer -> getRenderer ( ) -> setHeight ( $ pixels ) ; $ this -> writer -> getRenderer ( ) -> setWidth ( $ pixels ) ; return $ this ; } | Changes the size of the QrCode . |
6,924 | public function color ( $ red , $ green , $ blue ) { $ this -> writer -> getRenderer ( ) -> setForegroundColor ( new Rgb ( $ red , $ green , $ blue ) ) ; return $ this ; } | Changes the foreground color of a QrCode . |
6,925 | public function backgroundColor ( $ red , $ green , $ blue ) { $ this -> writer -> getRenderer ( ) -> setBackgroundColor ( new Rgb ( $ red , $ green , $ blue ) ) ; return $ this ; } | Changes the background color of a QrCode . |
6,926 | public static function login ( UserInterface $ user ) : void { Session :: regenerate ( false ) ; Session :: put ( 'wt_user' , $ user -> id ( ) ) ; } | Login directly as an explicit user - for masquerading . |
6,927 | public function render ( $ renderer ) { if ( $ this -> x1 === ReportBaseElement :: CURRENT_POSITION ) { $ this -> x1 = $ renderer -> getX ( ) ; } if ( $ this -> y1 === ReportBaseElement :: CURRENT_POSITION ) { $ this -> y1 = $ renderer -> getY ( ) ; } if ( $ this -> x2 === ReportBaseElement :: CURRENT_POSITION ) { $ th... | HTML line renderer |
6,928 | public static function getValues ( ) : array { $ values = [ ] ; foreach ( self :: TYPES as $ type ) { $ values [ $ type ] = self :: getValue ( $ type ) ; } return $ values ; } | A list of all possible values for QUAY |
6,929 | public function getAdminAction ( ) : ResponseInterface { $ this -> layout = 'layouts/administration' ; return $ this -> viewResponse ( 'modules/custom-css-js/edit' , [ 'title' => $ this -> title ( ) , 'head' => $ this -> getPreference ( 'head' ) , 'body' => $ this -> getPreference ( 'body' ) , ] ) ; } | Show a form to edit the user CSS and JS . |
6,930 | private function getCommonFacts ( ) : array { return array_merge ( Gedcom :: BIRTH_EVENTS , Gedcom :: MARRIAGE_EVENTS , Gedcom :: DIVORCE_EVENTS , Gedcom :: DEATH_EVENTS ) ; } | Retursn the list of common facts used query the data . |
6,931 | protected function startElement ( $ parser , string $ name , array $ attrs ) : void { $ newattrs = [ ] ; foreach ( $ attrs as $ key => $ value ) { if ( preg_match ( "/^\\$(\w+)$/" , $ value , $ match ) ) { if ( isset ( $ this -> vars [ $ match [ 1 ] ] [ 'id' ] ) && ! isset ( $ this -> vars [ $ match [ 1 ] ] [ 'gedcom' ... | XML start element handler This function is called whenever a starting element is reached The element handler will be called if found otherwise it must be HTML |
6,932 | protected function endElement ( $ parser , string $ name ) : void { if ( ( $ this -> process_footnote || $ name === 'Footnote' ) && ( $ this -> process_ifs === 0 || $ name === 'if' ) && ( $ this -> process_gedcoms === 0 || $ name === 'Gedcom' ) && ( $ this -> process_repeats === 0 || $ name === 'Facts' || $ name === 'R... | XML end element handler This function is called whenever an ending element is reached The element handler will be called if found otherwise it must be HTML |
6,933 | protected function characterData ( $ parser , $ data ) : void { if ( $ this -> print_data && $ this -> process_gedcoms === 0 && $ this -> process_ifs === 0 && $ this -> process_repeats === 0 ) { $ this -> current_element -> addText ( $ data ) ; } } | XML character data handler |
6,934 | private function gedcomStartHandler ( array $ attrs ) : void { if ( $ this -> process_gedcoms > 0 ) { $ this -> process_gedcoms ++ ; return ; } $ tag = $ attrs [ 'id' ] ; $ tag = str_replace ( '@fact' , $ this -> fact , $ tag ) ; $ tags = explode ( ':' , $ tag ) ; $ newgedrec = '' ; if ( count ( $ tags ) < 2 ) { $ tmp ... | Called at the start of an element . |
6,935 | private function gedcomEndHandler ( ) : void { if ( $ this -> process_gedcoms > 0 ) { $ this -> process_gedcoms -- ; } else { [ $ this -> gedrec , $ this -> fact , $ this -> desc ] = array_pop ( $ this -> gedrec_stack ) ; } } | Called at the end of an element . |
6,936 | private function addDescendancy ( & $ list , $ pid , $ parents = false , $ generations = - 1 ) : void { $ person = Individual :: getInstance ( $ pid , $ this -> tree ) ; if ( $ person === null ) { return ; } if ( ! isset ( $ list [ $ pid ] ) ) { $ list [ $ pid ] = $ person ; } if ( ! isset ( $ list [ $ pid ] -> generat... | Create a list of all descendants . |
6,937 | private function addAncestors ( array & $ list , string $ pid , bool $ children = false , int $ generations = - 1 ) : void { $ genlist = [ $ pid ] ; $ list [ $ pid ] -> generation = 1 ; while ( count ( $ genlist ) > 0 ) { $ id = array_shift ( $ genlist ) ; if ( strpos ( $ id , 'empty' ) === 0 ) { continue ; } $ person ... | Create a list of all ancestors . |
6,938 | private function getGedcomValue ( $ tag , $ level , $ gedrec ) : string { if ( empty ( $ gedrec ) ) { return '' ; } $ tags = explode ( ':' , $ tag ) ; $ origlevel = $ level ; if ( $ level == 0 ) { $ level = $ gedrec [ 0 ] + 1 ; } $ subrec = $ gedrec ; foreach ( $ tags as $ t ) { $ lastsubrec = $ subrec ; $ subrec = Fun... | get gedcom tag value |
6,939 | private function substituteVars ( $ expression , $ quote ) : string { return preg_replace_callback ( '/\$(\w+)/' , function ( array $ matches ) use ( $ quote ) : string { if ( isset ( $ this -> vars [ $ matches [ 1 ] ] [ 'id' ] ) ) { if ( $ quote ) { return "'" . addcslashes ( $ this -> vars [ $ matches [ 1 ] ] [ 'id' ... | Replace variable identifiers with their values . |
6,940 | public static function mkdir ( $ path ) : bool { if ( is_dir ( $ path ) ) { return true ; } if ( dirname ( $ path ) && ! is_dir ( dirname ( $ path ) ) ) { self :: mkdir ( dirname ( $ path ) ) ; } try { mkdir ( $ path ) ; return true ; } catch ( Throwable $ ex ) { return false ; } } | Create a folder and sub - folders if it does not already exist |
6,941 | public static function surnameTagCloud ( array $ surnames , ? ModuleListInterface $ module , bool $ totals , Tree $ tree ) : string { $ minimum = PHP_INT_MAX ; $ maximum = 1 ; foreach ( $ surnames as $ surn => $ surns ) { foreach ( $ surns as $ spfxsurn => $ count ) { $ maximum = max ( $ maximum , $ count ) ; $ minimum... | Print a tagcloud of surnames . |
6,942 | public static function surnameList ( $ surnames , $ style , $ totals , ? ModuleListInterface $ module , Tree $ tree ) : string { $ html = [ ] ; foreach ( $ surnames as $ surn => $ surns ) { if ( $ module instanceof ModuleListInterface ) { if ( $ surn ) { $ url = $ module -> listUrl ( $ tree , [ 'surname' => $ surn ] ) ... | Print a list of surnames . |
6,943 | public function list ( ) : ResponseInterface { return $ this -> viewResponse ( 'admin/modules' , [ 'title' => I18N :: translate ( 'All modules' ) , 'modules' => $ this -> module_service -> all ( true ) , 'deleted_modules' => $ this -> module_service -> deletedModules ( ) , ] ) ; } | Show the administrator a list of modules . |
6,944 | public function menuPalette ( ) : Menu { $ request = app ( ServerRequestInterface :: class ) ; $ menu = new Menu ( I18N :: translate ( 'Palette' ) , '#' , 'menu-color' ) ; foreach ( $ this -> palettes ( ) as $ palette_id => $ palette_name ) { $ url = ( string ) $ request -> getUri ( ) ; $ url = preg_replace ( '/&themec... | Create a menu of palette options |
6,945 | public function local ( ) : Carbon { $ locale = app ( LocaleInterface :: class ) -> code ( ) ; $ timezone = Auth :: user ( ) -> getPreference ( 'TIMEZONE' , Site :: getPreference ( 'TIMEZONE' , 'UTC' ) ) ; return $ this -> locale ( $ locale ) -> setTimezone ( $ timezone ) ; } | Create a local timestamp for the current user . |
6,946 | private function historicalFacts ( Individual $ individual ) : array { return $ this -> module_service -> findByInterface ( ModuleHistoricEventsInterface :: class ) -> map ( static function ( ModuleHistoricEventsInterface $ module ) use ( $ individual ) : Collection { return $ module -> historicEventsForIndividual ( $ ... | Get any historical events . |
6,947 | private function associateFacts ( Individual $ person ) : array { $ facts = [ ] ; $ associates = array_merge ( $ person -> linkedIndividuals ( 'ASSO' ) , $ person -> linkedIndividuals ( '_ASSO' ) , $ person -> linkedFamilies ( 'ASSO' ) , $ person -> linkedFamilies ( '_ASSO' ) ) ; foreach ( $ associates as $ associate )... | Get the events of associates . |
6,948 | public function quick ( ServerRequestInterface $ request , Tree $ tree ) : ResponseInterface { $ query = $ request -> get ( 'query' , '' ) ; $ record = GedcomRecord :: getInstance ( $ query , $ tree ) ; if ( $ record !== null && $ record -> canShow ( ) ) { return redirect ( $ record -> url ( ) ) ; } return $ this -> ge... | The omni - search box in the header . |
6,949 | private function extractSearchTerms ( string $ query ) : array { $ search_terms = [ ] ; while ( preg_match ( '/"([^"]+)"/' , $ query , $ match ) ) { $ search_terms [ ] = trim ( $ match [ 1 ] ) ; $ query = str_replace ( $ match [ 0 ] , '' , $ query ) ; } while ( preg_match ( '/[\S]+/' , $ query , $ match ) ) { $ search_... | Convert the query into an array of search terms |
6,950 | public function phonetic ( ServerRequestInterface $ request , Tree $ tree ) : ResponseInterface { $ firstname = $ request -> get ( 'firstname' , '' ) ; $ lastname = $ request -> get ( 'lastname' , '' ) ; $ place = $ request -> get ( 'place' , '' ) ; $ soundex = $ request -> get ( 'soundex' , 'Russell' ) ; if ( Site :: ... | The phonetic search . |
6,951 | public function advanced ( ServerRequestInterface $ request , Tree $ tree ) : ResponseInterface { $ default_fields = array_fill_keys ( self :: DEFAULT_ADVANCED_FIELDS , '' ) ; $ fields = $ request -> get ( 'fields' , $ default_fields ) ; $ modifiers = $ request -> get ( 'modifiers' , [ ] ) ; $ other_field = $ request -... | A structured search . |
6,952 | private function otherFields ( array $ fields ) : array { $ unused = array_diff ( self :: OTHER_ADVANCED_FIELDS , array_keys ( $ fields ) ) ; $ other_fileds = [ ] ; foreach ( $ unused as $ tag ) { $ other_fileds [ $ tag ] = GedcomTag :: getLabel ( $ tag ) ; } return $ other_fileds ; } | Extra search fields to add to the advanced search |
6,953 | private function getIso3166Countries ( ) : array { $ countries = $ this -> country_service -> getAllCountries ( ) ; $ country_to_iso3166 = [ ] ; foreach ( I18N :: activeLocales ( ) as $ locale ) { I18N :: init ( $ locale -> languageTag ( ) ) ; foreach ( $ this -> country_service -> iso3166 ( ) as $ three => $ two ) { $... | Returns the country names for each language . |
6,954 | private function createChartData ( array $ places ) : array { $ data = [ [ I18N :: translate ( 'Country' ) , I18N :: translate ( 'Total' ) , ] , ] ; foreach ( $ places as $ country => $ count ) { $ data [ ] = [ [ 'v' => $ country , 'f' => $ this -> country_service -> mapTwoLetterToName ( $ country ) , ] , $ count ] ; }... | Returns the data structure required by google geochart . |
6,955 | private function getBirthChartData ( ) : array { $ surn_countries = [ ] ; $ b_countries = $ this -> placeRepository -> statsPlaces ( 'INDI' , 'BIRT' , 0 , true ) ; foreach ( $ b_countries as $ country => $ count ) { if ( array_key_exists ( $ country , $ this -> country_to_iso3166 ) ) { $ country_code = $ this -> countr... | Returns the google geochart data for birth fact . |
6,956 | private function getDeathChartData ( ) : array { $ surn_countries = [ ] ; $ d_countries = $ this -> placeRepository -> statsPlaces ( 'INDI' , 'DEAT' , 0 , true ) ; foreach ( $ d_countries as $ country => $ count ) { if ( array_key_exists ( $ country , $ this -> country_to_iso3166 ) ) { $ country_code = $ this -> countr... | Returns the google geochart data for death fact . |
6,957 | private function getMarriageChartData ( ) : array { $ surn_countries = [ ] ; $ m_countries = $ this -> placeRepository -> statsPlaces ( 'FAM' ) ; foreach ( $ m_countries as $ place ) { if ( array_key_exists ( $ place -> country , $ this -> country_to_iso3166 ) ) { $ country_code = $ this -> country_to_iso3166 [ $ place... | Returns the google geochart data for marriages . |
6,958 | private function getSurnameChartData ( string $ surname ) : array { if ( $ surname === '' ) { $ surname = $ this -> individualRepository -> getCommonSurname ( ) ; } $ surn_countries = [ ] ; $ records = $ this -> queryRecords ( $ surname ) ; foreach ( $ records as $ row ) { if ( preg_match_all ( '/^2 PLAC (?:.*, *)*(.*)... | Returns the google geochart data for surnames . |
6,959 | private function getIndivdualChartData ( ) : array { $ surn_countries = [ ] ; $ a_countries = $ this -> placeRepository -> statsPlaces ( 'INDI' ) ; foreach ( $ a_countries as $ place ) { if ( array_key_exists ( $ place -> country , $ this -> country_to_iso3166 ) ) { $ country_code = $ this -> country_to_iso3166 [ $ pla... | Returns the google geochart data for individuals . |
6,960 | public function getPersonLi ( Individual $ person , $ generations = 0 ) : string { $ icon = $ generations > 0 ? 'icon-minus' : 'icon-plus' ; $ lifespan = $ person -> canShow ( ) ? '(' . $ person -> getLifeSpan ( ) . ')' : '' ; $ spouses = $ generations > 0 ? $ this -> loadSpouses ( $ person , 0 ) : '' ; return '<li cla... | Format an individual in a list . |
6,961 | public function getFamilyLi ( Family $ family , Individual $ person , $ generations = 0 ) : string { $ spouse = $ family -> spouse ( $ person ) ; if ( $ spouse ) { $ spouse_name = $ spouse -> getSexImage ( ) . $ spouse -> fullName ( ) ; $ spouse_link = '<a href="' . e ( $ person -> url ( ) ) . '" title="' . strip_tags ... | Format a family in a list . |
6,962 | public function loadSpouses ( Individual $ individual , $ generations ) : string { $ out = '' ; if ( $ individual -> canShow ( ) ) { foreach ( $ individual -> spouseFamilies ( ) as $ family ) { $ out .= $ this -> getFamilyLi ( $ family , $ individual , $ generations - 1 ) ; } } if ( $ out ) { return '<ul>' . $ out . '<... | Display spouses . |
6,963 | public function loadChildren ( Family $ family , $ generations ) : string { $ out = '' ; if ( $ family -> canShow ( ) ) { $ children = $ family -> children ( ) ; if ( $ children -> isNotEmpty ( ) ) { foreach ( $ children as $ child ) { $ out .= $ this -> getPersonLi ( $ child , $ generations - 1 ) ; } } else { $ out .=... | Display descendants . |
6,964 | public function acceptAllChanges ( ServerRequestInterface $ request , Tree $ tree ) : ResponseInterface { $ url = $ request -> get ( 'url' , '' ) ; $ changes = DB :: table ( 'change' ) -> where ( 'gedcom_id' , '=' , $ tree -> id ( ) ) -> where ( 'status' , '=' , 'pending' ) -> orderBy ( 'change_id' ) -> get ( ) ; forea... | Accept all changes to a tree . |
6,965 | public function rejectAllChanges ( ServerRequestInterface $ request , Tree $ tree ) : ResponseInterface { $ url = $ request -> get ( 'url' , '' ) ; DB :: table ( 'change' ) -> where ( 'gedcom_id' , '=' , $ tree -> id ( ) ) -> where ( 'status' , '=' , 'pending' ) -> update ( [ 'status' => 'rejected' ] ) ; return redirec... | Reject all changes to a tree . |
6,966 | public static function getAgeAtEvent ( string $ age_string ) : string { switch ( strtoupper ( $ age_string ) ) { case 'CHILD' : return I18N :: translate ( 'Child' ) ; case 'INFANT' : return I18N :: translate ( 'Infant' ) ; case 'STILLBORN' : return I18N :: translate ( 'Stillborn' ) ; default : return preg_replace_callb... | Convert a GEDCOM age string to localized text . |
6,967 | public function getActionPreview ( GedcomRecord $ record ) : string { $ old_lines = explode ( "\n" , $ record -> gedcom ( ) ) ; $ new_lines = explode ( "\n" , $ this -> updateRecord ( $ record ) ) ; $ algorithm = new MyersDiff ( ) ; $ differences = $ algorithm -> calculate ( $ old_lines , $ new_lines ) ; $ diff_lines =... | Default previewer for plugins with no custom preview . |
6,968 | public static function createEditLinks ( $ gedrec , GedcomRecord $ record ) : string { return preg_replace ( "/@([^#@\n]+)@/m" , '<a href="' . e ( route ( 'edit-raw-record' , [ 'ged' => $ record -> tree ( ) -> name ( ) , 'xref' => $ record -> xref ( ) , ] ) ) . '">@\\1@</a>' , $ gedrec ) ; } | Converted gedcom links into editable links |
6,969 | public function render ( $ renderer ) { $ renderer -> setCurrentStyle ( 'footnotenum' ) ; $ renderer -> Write ( $ renderer -> getCurrentStyleHeight ( ) , $ this -> numText , $ this -> addlink ) ; } | PDF Footnotes number renderer |
6,970 | public function getWidth ( $ renderer ) { $ renderer -> setCurrentStyle ( 'footnotenum' ) ; $ fsize = $ renderer -> getCurrentStyleHeight ( ) ; if ( $ fsize > $ renderer -> largestFontHeight ) { $ renderer -> largestFontHeight = $ fsize ; } if ( empty ( $ this -> num ) ) { $ renderer -> checkFootnote ( $ this ) ; } $ l... | Splits the text into lines to fit into a giving cell and returns the last lines width |
6,971 | public function mediaFiles ( ) : Collection { return $ this -> facts ( [ 'FILE' ] ) -> map ( function ( Fact $ fact ) : MediaFile { return new MediaFile ( $ fact -> gedcom ( ) , $ this ) ; } ) ; } | Get the media files for this media object |
6,972 | public function firstImageFile ( ) : ? MediaFile { foreach ( $ this -> mediaFiles ( ) as $ media_file ) { if ( $ media_file -> isImage ( ) ) { return $ media_file ; } } return null ; } | Get the first media file that contains an image . |
6,973 | public function getNote ( ) : string { $ fact = $ this -> facts ( [ 'NOTE' ] ) -> first ( ) ; if ( $ fact instanceof Fact ) { $ note = $ fact -> target ( ) ; if ( $ note instanceof Note ) { return $ note -> getNote ( ) ; } return $ fact -> value ( ) ; } return '' ; } | Get the first note attached to this media object |
6,974 | protected function countHit ( Tree $ tree , string $ page , string $ parameter ) : int { if ( Session :: get ( 'last_gedcom_id' ) === $ tree -> id ( ) && Session :: get ( 'last_page_name' ) === $ page && Session :: get ( 'last_page_parameter' ) === $ parameter ) { return ( int ) Session :: get ( 'last_count' ) ; } $ co... | Increment the page count . |
6,975 | public function reportList ( Tree $ tree , UserInterface $ user ) : ResponseInterface { $ title = I18N :: translate ( 'Choose a report to run' ) ; return $ this -> viewResponse ( 'report-select-page' , [ 'reports' => $ this -> module_service -> findByComponent ( ModuleReportInterface :: class , $ tree , $ user ) , 'tit... | A list of available reports . |
6,976 | private function runHousekeeping ( ) : void { $ data_filesystem = app ( FilesystemInterface :: class ) ; $ root_filesystem = new Filesystem ( new Local ( Webtrees :: ROOT_DIR ) ) ; $ this -> housekeeping_service -> deleteOldFiles ( $ data_filesystem , 'cache' , self :: MAX_CACHE_AGE ) ; $ this -> housekeeping_service -... | Run the various housekeeping services . |
6,977 | private static function convertMediaPath ( $ rec , $ path ) : string { if ( $ path && preg_match ( '/\n1 FILE (.+)/' , $ rec , $ match ) ) { $ old_file_name = $ match [ 1 ] ; if ( strpos ( $ old_file_name , '://' ) === false ) { if ( strpos ( $ path , '\\' ) !== false ) { $ new_file_name = preg_replace ( '~/+~' , '\\' ... | Prepend the GEDCOM_MEDIA_PATH to media filenames . |
6,978 | public function calendarMonthsInYear ( string $ calendar , int $ year ) : array { $ date = new Date ( $ calendar . ' ' . $ year ) ; $ calendar_date = $ date -> minimumDate ( ) ; $ month_numbers = range ( 1 , $ calendar_date -> monthsInYear ( ) ) ; $ month_names = [ ] ; foreach ( $ month_numbers as $ month_number ) { $ ... | List all the months in a given year . |
6,979 | public function getEventsList ( int $ jd1 , int $ jd2 , string $ events , bool $ only_living , string $ sort_by , Tree $ tree ) : array { $ found_facts = [ ] ; $ facts = [ ] ; foreach ( range ( $ jd1 , $ jd2 ) as $ jd ) { $ found_facts = array_merge ( $ found_facts , $ this -> getAnniversaryEvents ( $ jd , $ events , $... | Get the list of current and upcoming events sorted by anniversary date |
6,980 | private function defaultAnniversaries ( Builder $ query , AbstractCalendarDate $ anniv ) : void { if ( $ anniv -> day ( ) === 1 ) { $ query -> where ( 'd_day' , '<=' , 1 ) ; } elseif ( $ anniv -> day ( ) === $ anniv -> daysInMonth ( ) ) { $ query -> where ( 'd_day' , '>=' , $ anniv -> daysInMonth ( ) ) ; } else { $ que... | By default missing days have anniversaries on the first of the month and invalid days have anniversaries on the last day of the month . |
6,981 | private function adarIIAnniversaries ( Builder $ query , JewishDate $ anniv ) : void { if ( $ anniv -> day ( ) === 1 ) { $ query -> where ( 'd_day' , '<=' , 1 ) ; } elseif ( $ anniv -> day ( ) === $ anniv -> daysInMonth ( ) ) { $ query -> where ( 'd_day' , '>=' , $ anniv -> daysInMonth ( ) ) ; } else { $ query -> where... | ADS includes non - leap ADR . |
6,982 | private function nisanAnniversaries ( Builder $ query , JewishDate $ anniv ) : void { if ( $ anniv -> day === 1 && ! $ anniv -> isLeapYear ( ) ) { $ query -> where ( static function ( Builder $ query ) : void { $ query -> where ( static function ( Builder $ query ) : void { $ query -> where ( 'd_day' , '<=' , 1 ) -> wh... | 1 NSN includes 30 ADR if this year is non - leap . |
6,983 | public function chartChildren ( ) : string { $ data = [ [ I18N :: translate ( 'Century' ) , I18N :: translate ( 'Average number' ) ] ] ; foreach ( $ this -> queryRecords ( ) as $ record ) { $ data [ ] = [ $ this -> century_service -> centuryName ( ( int ) $ record -> century ) , ( float ) $ record -> num ] ; } $ chart_... | Creates a children per family chart . |
6,984 | private function isChild ( Individual $ individual ) : bool { $ age = Date :: getAgeYears ( $ individual -> getEstimatedBirthDate ( ) , $ this -> date ( ) ) ; return $ age < $ this -> age_adult ; } | Is the individual a child . |
6,985 | private function isDead ( Individual $ individual ) : bool { return $ individual -> getDeathDate ( ) -> isOK ( ) && Date :: compare ( $ individual -> getDeathDate ( ) , $ this -> date ( ) ) < 0 ; } | Is the individual dead . |
6,986 | public static function calendarNames ( ) : array { return [ 'gregorian' => I18N :: translate ( 'Gregorian' ) , 'julian' => I18N :: translate ( 'Julian' ) , 'french' => I18N :: translate ( 'French' ) , 'jewish' => I18N :: translate ( 'Jewish' ) , 'hijri' => I18N :: translate ( 'Hijri' ) , 'jalali' => I18N :: translate (... | A list of supported calendars and their names . |
6,987 | public function addYears ( int $ years , string $ qualifier = '' ) : Date { $ tmp = clone $ this ; $ tmp -> date1 -> year += $ years ; $ tmp -> date1 -> month = 0 ; $ tmp -> date1 -> day = 0 ; $ tmp -> date1 -> setJdFromYmd ( ) ; $ tmp -> qual1 = $ qualifier ; $ tmp -> qual2 = '' ; $ tmp -> date2 = null ; return $ tmp ... | Offset this date by N years and round to the whole year . |
6,988 | public static function getAge ( Date $ d1 , Date $ d2 = null ) : string { if ( $ d2 instanceof self ) { if ( $ d2 -> maximumJulianDay ( ) >= $ d1 -> minimumJulianDay ( ) && $ d2 -> minimumJulianDay ( ) <= $ d1 -> maximumJulianDay ( ) ) { $ jd = $ d1 -> minimumJulianDay ( ) ; } else { $ jd = $ d2 -> minimumJulianDay ( )... | Calculate the the age of a person on a date . |
6,989 | public static function compare ( Date $ a , Date $ b ) : int { switch ( $ a -> qual1 ) { case 'BEF' : $ amin = $ a -> minimumJulianDay ( ) - 1 ; $ amax = $ amin ; break ; case 'AFT' : $ amax = $ a -> maximumJulianDay ( ) + 1 ; $ amin = $ amax ; break ; default : $ amin = $ a -> minimumJulianDay ( ) ; $ amax = $ a -> ma... | Compare two dates so they can be sorted . |
6,990 | private function monthOptions ( ) : array { return [ 3 => I18N :: number ( 3 ) , 6 => I18N :: number ( 6 ) , 9 => I18N :: number ( 9 ) , 12 => I18N :: number ( 12 ) , 18 => I18N :: number ( 18 ) , 24 => I18N :: number ( 24 ) , ] ; } | Delete users older than this . |
6,991 | public function listMenu ( Tree $ tree ) : ? Menu { if ( $ this -> listIsEmpty ( $ tree ) ) { return null ; } return new Menu ( $ this -> listTitle ( ) , $ this -> listUrl ( $ tree ) , $ this -> listMenuClass ( ) , $ this -> listUrlAttributes ( ) ) ; } | A main menu item for this list or null if the list is empty . |
6,992 | public function listUrl ( Tree $ tree , array $ parameters = [ ] ) : string { return route ( 'module' , [ 'module' => $ this -> name ( ) , 'action' => 'List' , 'ged' => $ tree -> name ( ) , ] + $ parameters ) ; } | The URL for a page showing list options . |
6,993 | public static function birthDateComparator ( ) : Closure { return static function ( Individual $ x , Individual $ y ) : int { return Date :: compare ( $ x -> getEstimatedBirthDate ( ) , $ y -> getEstimatedBirthDate ( ) ) ; } ; } | A closure which will compare individuals by birth date . |
6,994 | public static function load ( Tree $ tree , array $ xrefs ) : void { $ rows = DB :: table ( 'individuals' ) -> where ( 'i_file' , '=' , $ tree -> id ( ) ) -> whereIn ( 'i_id' , array_unique ( $ xrefs ) ) -> select ( [ 'i_id AS xref' , 'i_gedcom AS gedcom' ] ) -> get ( ) ; foreach ( $ rows as $ row ) { self :: getInstan... | Sometimes we ll know in advance that we need to load a set of records . Typically when we load families and their members . |
6,995 | public function canShowName ( int $ access_level = null ) : bool { if ( $ access_level === null ) { $ access_level = Auth :: accessLevel ( $ this -> tree ) ; } return $ this -> tree -> getPreference ( 'SHOW_LIVING_NAMES' ) >= $ access_level || $ this -> canShow ( $ access_level ) ; } | Can the name of this record be shown? |
6,996 | protected function canShowByType ( int $ access_level ) : bool { if ( $ this -> tree -> getPreference ( 'SHOW_DEAD_PEOPLE' ) >= $ access_level && $ this -> isDead ( ) ) { $ keep_alive = false ; $ KEEP_ALIVE_YEARS_BIRTH = ( int ) $ this -> tree -> getPreference ( 'KEEP_ALIVE_YEARS_BIRTH' ) ; if ( $ KEEP_ALIVE_YEARS_BIRT... | Can this individual be shown? |
6,997 | private static function isRelated ( Individual $ target , $ distance ) : bool { static $ cache = null ; $ user_individual = self :: getInstance ( $ target -> tree -> getUserPreference ( Auth :: user ( ) , 'gedcomid' ) , $ target -> tree ) ; if ( $ user_individual ) { if ( ! $ cache ) { $ cache = [ 0 => [ $ user_individ... | For relationship privacy calculations - is this individual a close relative? |
6,998 | public function findHighlightedMediaFile ( ) : ? MediaFile { foreach ( $ this -> facts ( [ 'OBJE' ] ) as $ fact ) { $ media = $ fact -> target ( ) ; if ( $ media instanceof Media ) { foreach ( $ media -> mediaFiles ( ) as $ media_file ) { if ( $ media_file -> isImage ( ) && ! $ media_file -> isExternal ( ) ) { return $... | Find the highlighted media object for an individual |
6,999 | public function displayImage ( $ width , $ height , $ fit , $ attributes ) : string { $ media_file = $ this -> findHighlightedMediaFile ( ) ; if ( $ media_file !== null ) { return $ media_file -> displayImage ( $ width , $ height , $ fit , $ attributes ) ; } if ( $ this -> tree -> getPreference ( 'USE_SILHOUETTE' ) ) {... | Display the prefered image for this individual . Use an icon if no image is available . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.