_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q20400 | Date.calendarNames | train | public static function calendarNames(): array
{
return [
/* I18N: The gregorian calendar */
'gregorian' => I18N::translate('Gregorian'),
/* I18N: The julian calendar */
'julian' => I18N::translate('Julian'),
/* I18N: The French calendar */
... | php | {
"resource": ""
} |
q20401 | Date.addYears | train | 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();
| php | {
"resource": ""
} |
q20402 | Date.getAge | train | public static function getAge(Date $d1, Date $d2 = null): string
{
if ($d2 instanceof self) {
if ($d2->maximumJulianDay() >= $d1->minimumJulianDay() && $d2->minimumJulianDay() <= $d1->maximumJulianDay()) {
// Overlapping dates
$jd = $d1->minimumJulianDay();
... | php | {
"resource": ""
} |
q20403 | Date.compare | train | public static function compare(Date $a, Date $b): int
{
// Get min/max JD for each date.
switch ($a->qual1) {
case 'BEF':
$amin = $a->minimumJulianDay() - 1;
$amax = $amin;
break;
case 'AFT':
$amax = $a->maximumJ... | php | {
"resource": ""
} |
q20404 | UsersController.monthOptions | train | private function monthOptions(): array
{
return [
3 => I18N::number(3),
6 => I18N::number(6),
| php | {
"resource": ""
} |
q20405 | ModuleListTrait.listMenu | train | public function listMenu(Tree $tree): ?Menu
{
if ($this->listIsEmpty($tree)) {
return null;
}
return new Menu(
$this->listTitle(),
| php | {
"resource": ""
} |
q20406 | ModuleListTrait.listUrl | train | public function listUrl(Tree $tree, array $parameters = []): string
{
return route('module', [
'module' => $this->name(),
| php | {
"resource": ""
} |
q20407 | Individual.birthDateComparator | train | public static function birthDateComparator(): Closure
{
return static function (Individual $x, Individual $y): int {
return | php | {
"resource": ""
} |
q20408 | Individual.load | train | 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'])
| php | {
"resource": ""
} |
q20409 | Individual.canShowName | train | public function canShowName(int $access_level = null): bool
{
if ($access_level === null) {
$access_level = Auth::accessLevel($this->tree);
}
| php | {
"resource": ""
} |
q20410 | Individual.canShowByType | train | protected function canShowByType(int $access_level): bool
{
// Dead people...
if ($this->tree->getPreference('SHOW_DEAD_PEOPLE') >= $access_level && $this->isDead()) {
$keep_alive = false;
$KEEP_ALIVE_YEARS_BIRTH = (int) $this->tree->getPreference('KEEP_ALIVE_YEAR... | php | {
"resource": ""
} |
q20411 | Individual.isRelated | train | 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 = [
... | php | {
"resource": ""
} |
q20412 | Individual.findHighlightedMediaFile | train | public function findHighlightedMediaFile(): ?MediaFile
{
foreach ($this->facts(['OBJE']) as $fact) {
$media = $fact->target();
if ($media instanceof Media) {
foreach ($media->mediaFiles() as $media_file) {
| php | {
"resource": ""
} |
q20413 | Individual.displayImage | train | public function displayImage($width, $height, $fit, $attributes): string
{
$media_file = $this->findHighlightedMediaFile();
if ($media_file !== null) {
| php | {
"resource": ""
} |
q20414 | Individual.getBirthDate | train | public function getBirthDate(): Date
{
foreach ($this->getAllBirthDates() as $date) { | php | {
"resource": ""
} |
q20415 | Individual.getBirthPlace | train | public function getBirthPlace(): Place
{
foreach ($this->getAllBirthPlaces() as $place) {
return $place;
| php | {
"resource": ""
} |
q20416 | Individual.getDeathDate | train | public function getDeathDate(): Date
{
foreach ($this->getAllDeathDates() as $date) { | php | {
"resource": ""
} |
q20417 | Individual.getDeathPlace | train | public function getDeathPlace(): Place
{
foreach ($this->getAllDeathPlaces() as $place) {
return $place;
| php | {
"resource": ""
} |
q20418 | Individual.getAllBirthDates | train | public function getAllBirthDates(): array
{
foreach (Gedcom::BIRTH_EVENTS as $event) {
$tmp = $this->getAllEventDates([$event]);
| php | {
"resource": ""
} |
q20419 | Individual.getAllBirthPlaces | train | public function getAllBirthPlaces(): array
{
foreach (Gedcom::BIRTH_EVENTS as $event) {
$places = $this->getAllEventPlaces([$event]);
if | php | {
"resource": ""
} |
q20420 | Individual.getAllDeathDates | train | public function getAllDeathDates(): array
{
foreach (Gedcom::DEATH_EVENTS as $event) {
$tmp = $this->getAllEventDates([$event]);
| php | {
"resource": ""
} |
q20421 | Individual.getAllDeathPlaces | train | public function getAllDeathPlaces(): array
{
foreach (Gedcom::DEATH_EVENTS as $event) {
$places = $this->getAllEventPlaces([$event]);
if | php | {
"resource": ""
} |
q20422 | Individual.getEstimatedDeathDate | train | public function getEstimatedDeathDate(): Date
{
if ($this->estimated_death_date === null) {
foreach ($this->getAllDeathDates() as $date) {
if ($date->isOK()) {
$this->estimated_death_date = $date;
break;
}
}
... | php | {
"resource": ""
} |
q20423 | Individual.getCurrentSpouse | train | public function getCurrentSpouse(): ?Individual
{
$family = $this->spouseFamilies()->last();
if ($family instanceof Family) {
| php | {
"resource": ""
} |
q20424 | Individual.numberOfChildren | train | public function numberOfChildren(): int
{
if (preg_match('/\n1 NCHI (\d+)(?:\n|$)/', $this->gedcom(), $match)) {
return (int) $match[1];
}
$children = [];
foreach ($this->spouseFamilies() as $fam) {
| php | {
"resource": ""
} |
q20425 | Individual.primaryChildFamily | train | public function primaryChildFamily(): ?Family
{
$families = $this->childFamilies();
switch ($families->count()) {
case 0:
return null;
case 1:
return $families[0];
default:
// If there is more than one FAMC record, c... | php | {
"resource": ""
} |
q20426 | Individual.getSpouseFamilyLabel | train | public function getSpouseFamilyLabel(Family $family): string
{
$spouse = $family->spouse($this);
if ($spouse) {
| php | {
"resource": ""
} |
q20427 | Individual.getPrimaryParentsNames | train | public function getPrimaryParentsNames($classname = '', $display = ''): string
{
$fam = $this->primaryChildFamily();
if (!$fam) {
return '';
}
$txt = '<div';
if ($classname) {
$txt .= ' class="' . $classname . '"';
}
if ($display) {
... | php | {
"resource": ""
} |
q20428 | Individual.formatListDetails | train | public function formatListDetails(): string
{
return
$this->formatFirstMajorFact(Gedcom::BIRTH_EVENTS, 1) .
| php | {
"resource": ""
} |
q20429 | BranchesController.allAncestors | train | protected function allAncestors(Individual $individual): array
{
/** @var Individual[] $ancestors */
$ancestors = [
1 => $individual,
];
do {
$sosa = key($ancestors);
$family = $ancestors[$sosa]->primaryChildFamily();
if ($family !==... | php | {
"resource": ""
} |
q20430 | BranchesController.loadIndividuals | train | private function loadIndividuals(Tree $tree, string $surname, bool $soundex_dm, bool $soundex_std): array
{
$individuals = DB::table('individuals')
->join('name', static function (JoinClause $join): void {
$join
->on('name.n_file', '=', 'individuals.i_file')
... | php | {
"resource": ""
} |
q20431 | BranchesController.getPatriarchsHtml | train | public function getPatriarchsHtml(Tree $tree, array $individuals, array $ancestors, string $surname, bool $soundex_dm, bool $soundex_std): string
{
$html = '';
foreach ($individuals as $individual) {
foreach ($individual->childFamilies() as $family) {
foreach ($family->sp... | php | {
"resource": ""
} |
q20432 | ModuleHistoricEventsTrait.historicEventsForIndividual | train | public function historicEventsForIndividual(Individual $individual): Collection
{
$min_date = $individual->getEstimatedBirthDate();
$max_date = $individual->getEstimatedDeathDate();
return (new Collection($this->historicEventsAll()))
| php | {
"resource": ""
} |
q20433 | HitCountRepository.hitCountQuery | train | private function hitCountQuery($page_name, string $page_parameter = ''): string
{
if ($page_name === '') {
// index.php?ctype=gedcom
$page_name = 'index.php';
$page_parameter = 'gedcom:' . $this->tree->id();
} elseif ($page_name === 'index.php') {
... | php | {
"resource": ""
} |
q20434 | LocationController.getPlaceListLocation | train | private function getPlaceListLocation(int $id): array
{
// We know the id of the place in the placelocation table,
// now get the id of the same place in the places table
if ($id === 0) {
$fqpn = '';
} else {
$hierarchy = $this->getHierarchy($id);
... | php | {
"resource": ""
} |
q20435 | LocationController.childLocationStatus | train | private function childLocationStatus(int $parent_id): stdClass
{
$prefix = DB::connection()->getTablePrefix();
$expression =
$prefix . 'p0.pl_place IS NOT NULL AND ' . $prefix . 'p0.pl_lati IS NULL OR ' .
$prefix . 'p1.pl_place IS NOT NULL AND ' . $prefix . 'p1.pl_lati IS NU... | php | {
"resource": ""
} |
q20436 | LocationController.isLocationActive | train | private function isLocationActive(string $place_name): bool
{
$places = explode(Gedcom::PLACE_SEPARATOR, $place_name);
$query = DB::table('places AS p0')
->where('p0.p_place', '=', $places[0])
->select(['pl0.*']);
array_shift($places);
foreach ($places as $... | php | {
"resource": ""
} |
q20437 | Webtrees.createServerRequest | train | public function createServerRequest(): ServerRequestInterface
{
$server_request_creator = new ServerRequestCreator(
app(ServerRequestFactoryInterface::class),
app(UriFactoryInterface::class),
app(UploadedFileFactoryInterface::class),
app(StreamFactoryInterface... | php | {
"resource": ""
} |
q20438 | Webtrees.middleware | train | public function middleware(): array
{
return [
PhpEnvironment::class,
EmitResponse::class,
HandleExceptions::class,
ReadConfigIni::class,
UseDatabase::class,
UseDebugbar::class,
UpdateDatabaseSchema::class,
UseCa... | php | {
"resource": ""
} |
q20439 | AdminController.privacyRestrictions | train | private function privacyRestrictions(Tree $tree): array
{
return DB::table('default_resn')
->where('gedcom_id', '=', $tree->id())
->get()
->map(static function (stdClass $row) use ($tree): stdClass {
$row->record = null;
$row->label = '';
... | php | {
"resource": ""
} |
q20440 | AdminController.tagsForPrivacy | train | private function tagsForPrivacy(Tree $tree): array
{
$tags = array_unique(array_merge(
explode(',', $tree->getPreference('INDI_FACTS_ADD')),
explode(',', $tree->getPreference('INDI_FACTS_UNIQUE')),
explode(',', $tree->getPreference('FAM_FACTS_ADD')),
explode('... | php | {
"resource": ""
} |
q20441 | ServerCheckService.serverErrors | train | public function serverErrors($driver = ''): Collection
{
$errors = Collection::make([
$this->databaseDriverErrors($driver),
$this->checkPhpExtension('mbstring'),
$this->checkPhpExtension('iconv'),
$this->checkPhpExtension('pcre'),
$this->checkPhpEx... | php | {
"resource": ""
} |
q20442 | ServerCheckService.serverWarnings | train | public function serverWarnings($driver = ''): Collection
{
$warnings = Collection::make([
$this->databaseDriverWarnings($driver),
$this->checkPhpExtension('curl'),
$this->checkPhpExtension('gd'),
$this->checkPhpExtension('simplexml'),
$this->checkP... | php | {
"resource": ""
} |
q20443 | ServerCheckService.isFunctionDisabled | train | public function isFunctionDisabled(string $function): bool
{
$disable_functions = explode(',', ini_get('disable_functions'));
$disable_functions = array_map(static function (string $func): string {
return strtolower(trim($func));
}, $disable_functions);
| php | {
"resource": ""
} |
q20444 | ModuleAnalyticsTrait.analyticsCanShow | train | public function analyticsCanShow(): bool
{
$request = app(ServerRequestInterface::class);
// If the browser sets the DNT header, then we won't use analytics.
$dnt = $request->getServerParams()['HTTP_DNT'] ?? '';
if ($dnt === '1') {
return false;
| php | {
"resource": ""
} |
q20445 | MessageController.contactPage | train | public function contactPage(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$referer = $request->getHeaderLine('referer');
$body = $request->get('body', '');
$from_email = $request->get('from_email', '');
$from_name = $request->get('from_name', '');
... | php | {
"resource": ""
} |
q20446 | MessageController.validContacts | train | private function validContacts(Tree $tree): array
{
$contacts = [
$this->user_service->find((int) $tree->getPreference('CONTACT_USER_ID')),
| php | {
"resource": ""
} |
q20447 | MessageController.deliverMessage | train | private function deliverMessage(Tree $tree, UserInterface $sender, UserInterface $recipient, string $subject, string $body, string $url, string $ip): bool
{
$success = true;
// Temporarily switch to the recipient's language
I18N::init($recipient->getPreference('language'));
$body_t... | php | {
"resource": ""
} |
q20448 | SearchService.searchFamilyNames | train | public function searchFamilyNames(array $trees, array $search, int $offset = 0, int $limit = PHP_INT_MAX): Collection
{
$query = DB::table('families')
->leftJoin('name AS husb_name', static function (JoinClause $join): void {
$join
->on('husb_name.n_file', '='... | php | {
"resource": ""
} |
q20449 | SearchService.searchIndividualNames | train | public function searchIndividualNames(array $trees, array $search, int $offset = 0, int $limit = PHP_INT_MAX): Collection
{
$query = DB::table('individuals')
->join('name', static function (JoinClause $join): void {
$join
->on('name.n_file', '=', 'individuals.... | php | {
"resource": ""
} |
q20450 | SearchService.searchMedia | train | public function searchMedia(array $trees, array $search, int $offset = 0, int $limit = PHP_INT_MAX): Collection
{
$query = DB::table('media');
$this->whereTrees($query, 'media.m_file', $trees);
| php | {
"resource": ""
} |
q20451 | SearchService.searchPlaces | train | public function searchPlaces(Tree $tree, string $search, int $offset = 0, int $limit = PHP_INT_MAX): Collection
{
$query = DB::table('places AS p0')
->where('p0.p_file', '=', $tree->id())
->leftJoin('places AS p1', 'p1.p_id', '=', 'p0.p_parent_id')
->leftJoin('places AS p... | php | {
"resource": ""
} |
q20452 | SearchService.paginateQuery | train | private function paginateQuery(Builder $query, Closure $row_mapper, Closure $row_filter, int $offset, int $limit): Collection
{
$collection = new Collection();
foreach ($query->cursor() as $row) {
$record = $row_mapper($row);
// If the object has a method "canShow()", then u... | php | {
"resource": ""
} |
q20453 | SearchService.whereSearch | train | private function whereSearch(Builder $query, $field, array $search_terms): void
{
if ($field instanceof Expression) {
$field = $field->getValue();
}
foreach ($search_terms | php | {
"resource": ""
} |
q20454 | SearchService.wherePhonetic | train | private function wherePhonetic(Builder $query, $field, string $soundex): void
{
if ($soundex !== '') {
$query->where(static function (Builder $query) | php | {
"resource": ""
} |
q20455 | SearchService.rawGedcomFilter | train | private function rawGedcomFilter(array $search_terms): Closure
{
return static function (GedcomRecord $record) use ($search_terms): bool {
// Ignore non-genealogy fields
$gedcom = preg_replace('/\n\d (?:_UID) .*/', '', $record->gedcom());
| php | {
"resource": ""
} |
q20456 | SearchService.rowLimiter | train | private function rowLimiter(int $limit = 1000): Closure
{
return static function () use ($limit): void {
static $n = 0;
if (++$n > $limit) {
$message = I18N::translate('The | php | {
"resource": ""
} |
q20457 | MediaFileController.mediaDownload | train | public function mediaDownload(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$xref = $request->get('xref', '');
$fact_id = $request->get('fact_id');
$media = Media::getInstance($xref, $tree);
if ($media === null) {
throw new MediaNotFoundException... | php | {
"resource": ""
} |
q20458 | MediaFileController.generateImage | train | private function generateImage(MediaFile $media_file, array $params): ResponseInterface
{
try {
// Validate HTTP signature
$signature = $this->glideSignature();
$signature->validateRequest(parse_url(WT_BASE_URL . 'index.php', PHP_URL_PATH), $params);
$server... | php | {
"resource": ""
} |
q20459 | MediaFileController.httpStatusAsImage | train | private function httpStatusAsImage(int $status): ResponseInterface
{
$svg = '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect width="100" height="100" fill="#F88" /><text x="5" y="55" font-family="Verdana" font-size="35">' . $status . '</text></svg>';
// We can't use the actua... | php | {
"resource": ""
} |
q20460 | MediaFileController.fileExtensionAsImage | train | private function fileExtensionAsImage(string $extension): ResponseInterface
{
$extension = '.' . strtolower($extension);
$svg = '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect width="100" height="100" fill="#88F" /><text x="5" y="60" font-family="Verdana" font-size="30">' . ... | php | {
"resource": ""
} |
q20461 | DatatablesService.handle | train | public function handle(ServerRequestInterface $request, Builder $query, array $search_columns, array $sort_columns, Closure $callback): ResponseInterface
{
$search = $request->getQueryParams()['search']['value'] ?? '';
$start = (int) ($request->getQueryParams()['start'] ?? 0);
$length = (in... | php | {
"resource": ""
} |
q20462 | ReportParserBase.endElement | train | protected function endElement($parser, string $name): void
{
$method = $name . 'EndHandler';
| php | {
"resource": ""
} |
q20463 | EditIndividualController.addUnlinked | train | public function addUnlinked(Tree $tree): ResponseInterface
{
return $this->viewResponse('edit/new-individual', [
'tree' => $tree,
'title' => I18N::translate('Create an individual'),
'nextaction' => 'add_unlinked_indi_action',
'individual' => null,
... | php | {
"resource": ""
} |
q20464 | EditIndividualController.editName | train | public function editName(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$fact_id = $request->get('fact_id', '');
$xref = $request->get('xref', '');
$individual = Individual::getInstance($xref, $tree);
Auth::checkIndividualAccess($individual, true);
//... | php | {
"resource": ""
} |
q20465 | JewishDate.formatDay | train | protected function formatDay(): string
{
$locale = app(LocaleInterface::class)->language()->code();
if ($locale === 'he' || $locale === 'yi') {
| php | {
"resource": ""
} |
q20466 | JewishDate.formatShortYear | train | protected function formatShortYear(): string
{
$locale = app(LocaleInterface::class)->language()->code();
if ($locale === 'he' || $locale === 'yi') {
| php | {
"resource": ""
} |
q20467 | JewishDate.monthNameNominativeCase | train | protected function monthNameNominativeCase(int $month, bool $leap_year): string
{
static $translated_month_names;
if ($translated_month_names === null) {
$translated_month_names = [
0 => '',
/* I18N: a month in the Jewish calendar */
1 =... | php | {
"resource": ""
} |
q20468 | JewishDate.monthNameAbbreviated | train | protected function monthNameAbbreviated(int $month, bool $leap_year): string | php | {
"resource": ""
} |
q20469 | AbstractCalendarDate.dayNames | train | public function dayNames(int $day_number): string
{
static $translated_day_names;
if ($translated_day_names === null) {
$translated_day_names = [
0 => I18N::translate('Monday'),
1 => I18N::translate('Tuesday'),
2 => I18N::translate('Wednes... | php | {
"resource": ""
} |
q20470 | AbstractCalendarDate.dayNamesAbbreviated | train | protected function dayNamesAbbreviated(int $day_number): string
{
static $translated_day_names;
if ($translated_day_names === null) {
$translated_day_names = [
/* I18N: abbreviation for Monday */
0 => I18N::translate('Mon'),
/* I18N: abbre... | php | {
"resource": ""
} |
q20471 | AbstractCalendarDate.compare | train | public static function compare(AbstractCalendarDate $d1, AbstractCalendarDate $d2): int
{
if ($d1->maximum_julian_day < $d2->minimum_julian_day) {
return -1;
}
if | php | {
"resource": ""
} |
q20472 | AbstractCalendarDate.getAge | train | public function getAge(int $jd): int
{
if ($this->year === 0 || $jd === 0) {
return 0;
}
if ($this->minimum_julian_day < $jd && $this->maximum_julian_day > $jd) {
return 0;
}
if ($this->minimum_julian_day === $jd) {
return 0;
}
... | php | {
"resource": ""
} |
q20473 | AbstractCalendarDate.getAgeFull | train | public function getAgeFull(int $jd): string
{
if ($this->year === 0 || $jd === 0) {
return '';
}
if ($this->minimum_julian_day < $jd && $this->maximum_julian_day > $jd) {
return '';
}
if ($this->minimum_julian_day === $jd) {
return '';
... | php | {
"resource": ""
} |
q20474 | AbstractCalendarDate.convertToCalendar | train | public function convertToCalendar(string $calendar): AbstractCalendarDate
{
switch ($calendar) {
case 'gregorian':
return new GregorianDate($this);
case 'julian':
return new JulianDate($this);
case 'jewish':
return new Jewis... | php | {
"resource": ""
} |
q20475 | AbstractCalendarDate.inValidRange | train | public function inValidRange(): bool
{
return $this->minimum_julian_day | php | {
"resource": ""
} |
q20476 | AbstractCalendarDate.daysInMonth | train | public function daysInMonth(): int
{
try {
return $this->calendar->daysInMonth($this->year, $this->month);
} catch (InvalidArgumentException $ex) {
// calendar.php calls this with "DD MMM" dates, for which we cannot calculate
| php | {
"resource": ""
} |
q20477 | AbstractCalendarDate.formatDayZeros | train | protected function formatDayZeros(): string
{
if ($this->day > 9) {
return I18N::digits($this->day);
| php | {
"resource": ""
} |
q20478 | AbstractCalendarDate.formatDayOfYear | train | protected function formatDayOfYear(): string
{
return I18N::digits($this->minimum_julian_day - | php | {
"resource": ""
} |
q20479 | AbstractCalendarDate.formatMonthZeros | train | protected function formatMonthZeros(): string
{
if ($this->month > 9) {
return I18N::digits($this->month);
| php | {
"resource": ""
} |
q20480 | AbstractCalendarDate.formatLongMonth | train | protected function formatLongMonth($case = 'NOMINATIVE'): string
{
switch ($case) {
case 'GENITIVE':
return $this->monthNameGenitiveCase($this->month, $this->isLeapYear());
case 'NOMINATIVE':
return $this->monthNameNominativeCase($this->month, $this->i... | php | {
"resource": ""
} |
q20481 | AbstractCalendarDate.formatGedcomMonth | train | protected function formatGedcomMonth(): string
{
// Our simple lookup table doesn't work correctly for Adar on leap years
if ($this->month === | php | {
"resource": ""
} |
q20482 | AbstractCalendarDate.calendarUrl | train | public function calendarUrl(string $date_format, Tree $tree): string
{
if ($this->day !== 0 && strpbrk($date_format, 'dDj')) {
// If the format includes a day, and the date also includes a day, then use the day view
$view = 'day';
} elseif ($this->month !== 0 && strpbrk($date... | php | {
"resource": ""
} |
q20483 | View.endpushunique | train | public static function endpushunique(): void
{
$content = ob_get_clean();
| php | {
"resource": ""
} |
q20484 | View.stack | train | public static function stack(string $stack): string
{
$content = implode('', self::$stacks[$stack] ?? []);
| php | {
"resource": ""
} |
q20485 | View.getFilenameForView | train | public function getFilenameForView(string $view_name): string
{
// If we request "::view", then use it explicityly. Don't allow replacements.
$explicit = Str::startsWith($view_name, self::NAMESPACE_SEPARATOR);
if (!Str::contains($view_name, self::NAMESPACE_SEPARATOR)) {
$view_n... | php | {
"resource": ""
} |
q20486 | View.make | train | public static function make($name, $data = []): string
{
$view = new static($name, $data);
| php | {
"resource": ""
} |
q20487 | ClipboardService.pasteFact | train | public function pasteFact(string $fact_id, GedcomRecord $record): bool
{
$clipboard = Session::get('clipboard');
$record_type = $record::RECORD_TYPE;
if (isset($clipboard[$record_type][$fact_id])) {
| php | {
"resource": ""
} |
q20488 | ClipboardService.pastableFacts | train | public function pastableFacts(GedcomRecord $record, Collection $exclude_types): Collection
{
// The facts are stored in the session.
return (new Collection(Session::get('clipboard', [])[$record::RECORD_TYPE] ?? []))
// Put the most recently copied fact at the top of the list.
... | php | {
"resource": ""
} |
q20489 | ClipboardService.pastableFactsOfType | train | public function pastableFactsOfType(GedcomRecord $record, Collection $types): Collection
{
// The facts are stored in the session.
return (new Collection(Session::get('clipboard', [])))
->flatten(1)
->reverse()
->map(static function (array $clipping) use ($record)... | php | {
"resource": ""
} |
q20490 | Tree.getAll | train | public static function getAll(): array
{
if (empty(self::$trees)) { | php | {
"resource": ""
} |
q20491 | Tree.all | train | public static function all(): Collection
{
return app('cache.array')->rememberForever(__CLASS__, static function (): Collection {
// Admins see all trees
$query = DB::table('gedcom')
->leftJoin('gedcom_setting', static function (JoinClause $join): void {
... | php | {
"resource": ""
} |
q20492 | Tree.create | train | public static function create(string $tree_name, string $tree_title): Tree
{
try {
// Create a new tree
DB::table('gedcom')->insert([
'gedcom_name' => $tree_name,
]);
$tree_id = (int) DB::connection()->getPdo()->lastInsertId();
$t... | php | {
"resource": ""
} |
q20493 | Tree.findByName | train | public static function findByName($tree_name): ?Tree
{
foreach (self::getAll() as $tree) { | php | {
"resource": ""
} |
q20494 | Tree.delete | train | public function delete(): void
{
// If this is the default tree, then unset it
if (Site::getPreference('DEFAULT_GEDCOM') === $this->name) {
Site::setPreference('DEFAULT_GEDCOM', '');
}
$this->deleteGenealogyData(false);
DB::table('block_setting')
->j... | php | {
"resource": ""
} |
q20495 | Tree.exportGedcom | train | public function exportGedcom($stream): void
{
$buffer = FunctionsExport::reformatRecord(FunctionsExport::gedcomHeader($this, 'UTF-8'));
$union_families = DB::table('families')
->where('f_file', '=', $this->id)
->select(['f_gedcom AS gedcom', 'f_id AS xref', DB::raw('LENGTH(f... | php | {
"resource": ""
} |
q20496 | Tree.importGedcomFile | train | public function importGedcomFile(StreamInterface $stream, string $filename): void
{
// Read the file in blocks of roughly 64K. Ensure that each block
// contains complete gedcom records. This will ensure we don’t split
// multi-byte characters, as well as simplifying the code to import
... | php | {
"resource": ""
} |
q20497 | Tree.createRecord | train | public function createRecord(string $gedcom): GedcomRecord
{
if (!Str::startsWith($gedcom, '0 @@ ')) {
throw new InvalidArgumentException('GedcomRecord::createRecord(' . $gedcom . ') does not begin 0 @@');
}
$xref = $this->getNewXref();
$gedcom = '0 @' . $xref . '@ ' .... | php | {
"resource": ""
} |
q20498 | Tree.getNewXref | train | public function getNewXref(): string
{
// Lock the row, so that only one new XREF may be generated at a time.
DB::table('site_setting')
->where('setting_name', '=', 'next_xref')
->lockForUpdate()
->get();
$prefix = 'X';
$increment = 1.0;
... | php | {
"resource": ""
} |
q20499 | Tree.significantIndividual | train | public function significantIndividual(UserInterface $user): Individual
{
$individual = null;
if ($this->getUserPreference($user, 'rootid') !== '') {
$individual = Individual::getInstance($this->getUserPreference($user, 'rootid'), $this);
}
if ($individual === null && $t... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.