_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q20500
SetupController.setup
train
public function setup(ServerRequestInterface $request): ResponseInterface { // Mini "bootstrap" define('WT_DATA_DIR', 'data/'); app()->instance(ServerRequestInterface::class, $request); app()->instance('cache.array', new Repository(new ArrayStore())); $data = $this->userData...
php
{ "resource": "" }
q20501
SetupController.setupLocales
train
private function setupLocales(): array { return app(ModuleService::class) ->setupLanguages()
php
{ "resource": "" }
q20502
SetupController.checkFolderIsWritable
train
private function checkFolderIsWritable(string $data_dir): bool { $text1 = random_bytes(32); try { file_put_contents($data_dir . 'test.txt', $text1);
php
{ "resource": "" }
q20503
ChartBirth.chartBirth
train
public function chartBirth(string $color_from = null, string $color_to = null): string { $chart_color1 = (string) $this->theme->parameter('distribution-chart-no-values'); $chart_color2 = (string) $this->theme->parameter('distribution-chart-high-values'); $color_from = $color_from ?? $chart...
php
{ "resource": "" }
q20504
CountryService.mapTwoLetterToName
train
public function mapTwoLetterToName(string $twoLetterCode): string { $threeLetterCode = array_search($twoLetterCode, $this->iso3166(), true);
php
{ "resource": "" }
q20505
GedcomRecordController.show
train
public function show(ServerRequestInterface $request, Tree $tree): ResponseInterface { $xref = $request->get('xref', ''); $record = GedcomRecord::getInstance($xref, $tree); Auth::checkRecordAccess($record); if ($this->hasCustomPage($record)) { return redirect($record-...
php
{ "resource": "" }
q20506
GedcomRecordController.hasCustomPage
train
private function hasCustomPage(GedcomRecord $record): bool { return $record instanceof Individual || $record instanceof Family || $record instanceof Source || $record
php
{ "resource": "" }
q20507
GedcomService.canonicalTag
train
public function canonicalTag(string $tag): string { $tag = strtoupper($tag);
php
{ "resource": "" }
q20508
GedcomService.readSex
train
public function readSex(string $text): string { $text = strtoupper($text);
php
{ "resource": "" }
q20509
ModuleCustomTrait.assetUrl
train
public function assetUrl(string $asset): string { $file = $this->resourcesFolder() . $asset; // Add the file's modification time to the URL, so we can set long expiry cache headers. $hash = filemtime($file); return route('module', [
php
{ "resource": "" }
q20510
ReportHtmlFootnote.render
train
public function render($renderer) { $renderer->setCurrentStyle('footnotenum'); echo '<a href="#footnote', $this->num, '"><sup>';
php
{ "resource": "" }
q20511
ReportHtmlFootnote.getFootnoteHeight
train
public function getFootnoteHeight($html, float $cellWidth = 0): float { if ($html->getCurrentStyle() != $this->styleName) { $html->setCurrentStyle($this->styleName); } if ($cellWidth > 0) { $this->text = $html->textWrap($this->text, $cellWidth); }
php
{ "resource": "" }
q20512
ColorService.interpolateRgb
train
public function interpolateRgb(string $startColor, string $endColor, int $steps): array { if (!$steps) { return []; } $s = $this->hexToRgb($startColor); $e = $this->hexToRgb($endColor); $colors = []; $factorR = ($e[0] - $s[0]) / $steps; ...
php
{ "resource": "" }
q20513
ColorService.rgbToHex
train
private function rgbToHex(int $r, int $g, int $b): string
php
{ "resource": "" }
q20514
GedcomTag.getPicklistFacts
train
public static function getPicklistFacts($fact_type): array { switch ($fact_type) { case 'INDI': $tags = [ // Facts, attributes for individuals (no links to FAMs) 'RESN', 'NAME', 'SEX', ...
php
{ "resource": "" }
q20515
GedcomTag.createUid
train
public static function createUid(): string { $uid = str_replace('-', '', Uuid::uuid4()->toString()); $checksum_a = 0; // a sum of the bytes $checksum_b = 0; // a sum of the incremental values of $checksum_a // Compute checksums for ($i = 0; $i < 32; $i += 2) {
php
{ "resource": "" }
q20516
ControlPanelController.controlPanelManager
train
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', [ 'titl...
php
{ "resource": "" }
q20517
ControlPanelController.totalChanges
train
private function totalChanges(): array { return DB::table('gedcom') ->leftJoin('change', static function (JoinClause $join): void { $join ->on('change.gedcom_id', '=', 'gedcom.gedcom_id')
php
{ "resource": "" }
q20518
ControlPanelController.totalFamilies
train
private function totalFamilies(): Collection { return DB::table('gedcom') ->leftJoin('families', 'f_file', '=', 'gedcom_id')
php
{ "resource": "" }
q20519
ControlPanelController.totalNotes
train
private function totalNotes(): Collection { return DB::table('gedcom') ->leftJoin('other', static function (JoinClause $join): void { $join ->on('o_file', '=', 'gedcom_id')
php
{ "resource": "" }
q20520
CensusColumnFullName.nameAtCensusDate
train
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->...
php
{ "resource": "" }
q20521
SurnameTradition.create
train
public static function create($name): SurnameTraditionInterface { switch ($name) { case 'paternal': return new PaternalSurnameTradition(); case 'patrilineal': return new PatrilinealSurnameTradition(); case 'matrilineal': ret...
php
{ "resource": "" }
q20522
Log.addConfigurationLog
train
public static function addConfigurationLog($message, Tree $tree =
php
{ "resource": "" }
q20523
Log.addEditLog
train
public static function addEditLog($message, Tree $tree): void {
php
{ "resource": "" }
q20524
Log.addSearchLog
train
public static function addSearchLog($message, array $trees): void { foreach ($trees as $tree) {
php
{ "resource": "" }
q20525
AbstractModule.getBlockSetting
train
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')
php
{ "resource": "" }
q20526
AbstractModule.setBlockSetting
train
final protected function setBlockSetting(int $block_id, string $setting_name, string $setting_value): self { DB::table('block_setting')->updateOrInsert([
php
{ "resource": "" }
q20527
AbstractModule.getPreference
train
final public function getPreference(string $setting_name, string $default = ''): string { return DB::table('module_setting') ->where('module_name', '=', $this->name())
php
{ "resource": "" }
q20528
AbstractModule.setPreference
train
final public function setPreference(string $setting_name, string $setting_value): void { DB::table('module_setting')->updateOrInsert([ 'module_name' => $this->name(),
php
{ "resource": "" }
q20529
AbstractModule.accessLevel
train
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')
php
{ "resource": "" }
q20530
FamilyController.show
train
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_servi...
php
{ "resource": "" }
q20531
Functions.fileUploadErrorText
train
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: // I18N: PHP internal er...
php
{ "resource": "" }
q20532
Functions.getSubRecord
train
public static function getSubRecord($level, $tag, $gedrec, $num = 1): string { if (empty($gedrec)) { return ''; } // -- adding \n before and after gedrec $gedrec = "\n" . $gedrec . "\n"; $tag = trim($tag); $searchTarget = "~[\n]" . $tag . "[...
php
{ "resource": "" }
q20533
Functions.getCont
train
public static function getCont($nlevel, $nrec): string { $text = ''; $subrecords = explode("\n", $nrec); foreach ($subrecords as $thisSubrecord) { if (substr($thisSubrecord, 0, 2) !== $nlevel . ' ') { continue;
php
{ "resource": "" }
q20534
Functions.getCloseRelationshipName
train
public static function getCloseRelationshipName(Individual $individual1, Individual $individual2): string { if ($individual1 === $individual2) { return self::reflexivePronoun($individual1);
php
{ "resource": "" }
q20535
Functions.reflexivePronoun
train
private static function reflexivePronoun(Individual $individual): string { switch ($individual->sex()) { case 'M': /* I18N: reflexive pronoun */ return I18N::translate('himself');
php
{ "resource": "" }
q20536
EditGedcomRecordController.deleteFact
train
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 ($reco...
php
{ "resource": "" }
q20537
EditGedcomRecordController.pasteFact
train
public function pasteFact(ServerRequestInterface $request, Tree $tree, ClipboardService $clipboard_service): ResponseInterface { $xref = $request->get('xref', '');
php
{ "resource": "" }
q20538
MediaRepository.totalMediaTypeQuery
train
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_...
php
{ "resource": "" }
q20539
MediaRepository.getSortedMediaTypeList
train
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 (...
php
{ "resource": "" }
q20540
IndividualController.formatSexRecord
train
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;...
php
{ "resource": "" }
q20541
ReportHtmlText.getWidth
train
public function getWidth($renderer) { // Setup the style name, a font must be selected to calculate the width if ($renderer->getCurrentStyle() != $this->styleName) { $renderer->setCurrentStyle($this->styleName); } // Check for the largest font size in the box $fs...
php
{ "resource": "" }
q20542
TimeoutService.isTimeNearlyUp
train
public function isTimeNearlyUp(float $threshold = self::TIME_UP_THRESHOLD): bool { $max_execution_time = (int) ini_get('max_execution_time'); // If there's no time limit, then we can't run out of time. if ($max_execution_time === 0) { return
php
{ "resource": "" }
q20543
TimeoutService.isTimeLimitUp
train
public function isTimeLimitUp(float $limit = self::TIME_LIMIT): bool { $now = microtime(true);
php
{ "resource": "" }
q20544
I18N.activeLocales
train
public static function activeLocales(): array { $locales = app(ModuleService::class) ->findByInterface(ModuleLanguageInterface::class, false, true) ->map(static function (ModuleLanguageInterface $module): LocaleInterface { return $module->locale();
php
{ "resource": "" }
q20545
I18N.installedLocales
train
public static function installedLocales(): Collection { return app(ModuleService::class) ->findByInterface(ModuleLanguageInterface::class, true)
php
{ "resource": "" }
q20546
I18N.strcasecmp
train
public static function strcasecmp($string1, $string2): int { if (self::$collator instanceof Collator) { return self::$collator->compare($string1, $string2);
php
{ "resource": "" }
q20547
I18N.strtolower
train
public static function strtolower($string): string { if (in_array(self::$locale->language()->code(), self::DOTLESS_I_LOCALES, true)) { $string = strtr($string,
php
{ "resource": "" }
q20548
I18N.strtoupper
train
public static function strtoupper($string): string { if (in_array(self::$locale->language()->code(), self::DOTLESS_I_LOCALES, true)) { $string = strtr($string,
php
{ "resource": "" }
q20549
I18N.textScript
train
public static function textScript($string): string { $string = strip_tags($string); // otherwise HTML tags show up as latin $string = html_entity_decode($string, ENT_QUOTES, 'UTF-8'); // otherwise HTML entities show up as latin $string = str_replace([ '@N.N.', '@P.N.'...
php
{ "resource": "" }
q20550
UserService.find
train
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)
php
{ "resource": "" }
q20551
UserService.findByEmail
train
public function findByEmail($email): ?User { return DB::table('user') ->where('email', '=', $email)
php
{ "resource": "" }
q20552
UserService.findByIdentifier
train
public function findByIdentifier($identifier): ?User { return DB::table('user') ->where('user_name', '=', $identifier) ->orWhere('email', '=', $identifier)
php
{ "resource": "" }
q20553
UserService.findByUserName
train
public function findByUserName($user_name): ?User { return DB::table('user') ->where('user_name', '=', $user_name)
php
{ "resource": "" }
q20554
UserService.administrators
train
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', '=', 'can...
php
{ "resource": "" }
q20555
UserService.allLoggedIn
train
public function allLoggedIn(): Collection { return DB::table('user') ->join('session', 'session.user_id', '=', 'user.user_id') ->where('user.user_id', '>', 0) ->orderBy('real_name')
php
{ "resource": "" }
q20556
UserService.create
train
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'
php
{ "resource": "" }
q20557
PlaceRepository.statsPlaces
train
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 $...
php
{ "resource": "" }
q20558
PlaceRepository.getTop10Places
train
private function getTop10Places(array $places): array { $top10 = []; $i = 0; arsort($places); foreach ($places as $place => $count) { $tmp
php
{ "resource": "" }
q20559
PlaceRepository.commonCountriesList
train
public function commonCountriesList(): string { $countries = $this->statsPlaces(); if (empty($countries)) { return ''; } $top10 = []; $i = 1; // Get the country names for each language $country_names = []; foreach (I18N::activeLocale...
php
{ "resource": "" }
q20560
AbstractReport.setup
train
public function setup(): void { $this->rtl = I18N::direction() === 'rtl'; $this->rkeywords = ''; // I18N: This is a report footer. %s is the name of the application.
php
{ "resource": "" }
q20561
AbstractReport.getStyle
train
public function getStyle(string $s): array { if (!isset($this->styles[$s])) {
php
{ "resource": "" }
q20562
UpdateDatabaseSchema.process
train
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface {
php
{ "resource": "" }
q20563
AdminSiteController.cleanData
train
public function cleanData(ServerRequestInterface $request, FilesystemInterface $filesystem): ResponseInterface { $protected = [ '.htaccess', '.gitignore', 'index.php', 'config.ini.php', ]; if ($request->getAttribute('dbtype') === 'sqlite') { ...
php
{ "resource": "" }
q20564
AdminSiteController.cleanDataAction
train
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($pa...
php
{ "resource": "" }
q20565
AdminSiteController.logsQuery
train
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 = $r...
php
{ "resource": "" }
q20566
AdminSiteController.serverInformation
train
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];
php
{ "resource": "" }
q20567
ContactsFooterModule.contactLinkTechnical
train
public function contactLinkTechnical(User $user): string { return I18N::translate('For technical support and
php
{ "resource": "" }
q20568
GedcomRecord.nameComparator
train
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()); } re...
php
{ "resource": "" }
q20569
GedcomRecord.lastChangeComparator
train
public static function lastChangeComparator(int $direction = 1): Closure { return static function (GedcomRecord $x, GedcomRecord $y) use ($direction): int {
php
{ "resource": "" }
q20570
GedcomRecord.parseFacts
train
private function parseFacts(): void { // Split the record into facts if ($this->gedcom) { $gedcom_facts = preg_split('/\n(?=1)/s', $this->gedcom); array_shift($gedcom_facts); } else { $gedcom_facts = []; } if ($this->pending) { ...
php
{ "resource": "" }
q20571
GedcomRecord.canShowRecord
train
private function canShowRecord(int $access_level): bool { // This setting would better be called "$ENABLE_PRIVACY" if (!$this->tree->getPreference('HIDE_LIVE_PEOPLE')) { return true; } // We should always be able to see our own record (unless an admin is applying downloa...
php
{ "resource": "" }
q20572
GedcomRecord.canShow
train
public function canShow(int $access_level = null): bool { $access_level = $access_level ?? Auth::accessLevel($this->tree); // We use this value to bypass privacy checks. For example, // when downloading data or when calculating privacy itself. if ($access_level === Auth::PRIV_HIDE) ...
php
{ "resource": "" }
q20573
GedcomRecord.privatizeGedcom
train
public function privatizeGedcom(int $access_level): string { if ($access_level === Auth::PRIV_HIDE) { // We may need the original record, for example when downloading a GEDCOM or clippings cart return $this->gedcom; } if ($this->canShow($access_level)) { ...
php
{ "resource": "" }
q20574
GedcomRecord.alternateName
train
public function alternateName(): ?string { if ($this->canShowName() && $this->getPrimaryName() !== $this->getSecondaryName()) { $all_names = $this->getAllNames();
php
{ "resource": "" }
q20575
GedcomRecord.formatList
train
public function formatList(): string { $html = '<a href="' . e($this->url()) . '" class="list_item">'; $html .= '<b>' . $this->fullName() . '</b>';
php
{ "resource": "" }
q20576
GedcomRecord.linkedRepositories
train
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()) ...
php
{ "resource": "" }
q20577
GedcomRecord.getAllEventPlaces
train
public function getAllEventPlaces(array $events): array { $places = []; foreach ($this->facts($events) as $event) { if (preg_match_all('/\n(?:2 PLAC|3 (?:ROMN|FONE|_HEB)) +(.+)/',
php
{ "resource": "" }
q20578
GedcomRecord.facts
train
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) || $...
php
{ "resource": "" }
q20579
GedcomRecord.lastChangeTimestamp
train
public function lastChangeTimestamp(): Carbon { /** @var Fact|null $chan */ $chan = $this->facts(['CHAN'])->first(); if ($chan instanceof Fact) { // The record does have a CHAN event $d = $chan->date()->minimumDate(); if (preg_match('/\n3 TIME (\d\d):(\d...
php
{ "resource": "" }
q20580
GedcomRecord.lastChangeUser
train
public function lastChangeUser(): string { $chan = $this->facts(['CHAN'])->first(); if ($chan === null) { return I18N::translate('Unknown');
php
{ "resource": "" }
q20581
GedcomRecord.createFact
train
public function createFact(string $gedcom, bool $update_chan): void {
php
{ "resource": "" }
q20582
GedcomRecord.deleteFact
train
public function deleteFact(string $fact_id, bool $update_chan): void {
php
{ "resource": "" }
q20583
GedcomRecord.updateFact
train
public function updateFact(string $fact_id, string $gedcom, bool $update_chan): void { // MSDOS line endings will break things in horrible ways $gedcom = preg_replace('/[\r\n]+/', "\n", $gedcom); $gedcom = trim($gedcom); if ($this->pending === '') { throw new Exception('...
php
{ "resource": "" }
q20584
GedcomRecord.updateRecord
train
public function updateRecord(string $gedcom, bool $update_chan): void { // MSDOS line endings will break things in horrible ways $gedcom = preg_replace('/[\r\n]+/', "\n", $gedcom); $gedcom = trim($gedcom); // Update the CHAN record if ($update_chan) { $gedcom = p...
php
{ "resource": "" }
q20585
GedcomRecord.linkingRecords
train
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']); ...
php
{ "resource": "" }
q20586
ChartSex.chartSex
train
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'; ...
php
{ "resource": "" }
q20587
EditNoteController.createNoteObjectAction
train
public function createNoteObjectAction(ServerRequestInterface $request, Tree $tree): ResponseInterface { $note = $request->get('note', ''); $privacy_restriction = $request->get('privacy-restriction', ''); $edit_restriction = $request->get('edit-restriction', ''); /...
php
{ "resource": "" }
q20588
ClippingsCartModule.allRecordsInCart
train
private function allRecordsInCart(Tree $tree): array { $cart = Session::get('cart', []); $xrefs = array_keys($cart[$tree->name()] ?? []); // Fetch all the records in the cart. $records = array_map(static function (string $xref) use ($tree): GedcomRecord {
php
{ "resource": "" }
q20589
ClippingsCartModule.addRecordToCart
train
private function addRecordToCart(GedcomRecord $record): void { $cart = Session::get('cart', []); $tree_name = $record->tree()->name(); // Add this record $cart[$tree_name][$record->xref()] = true;
php
{ "resource": "" }
q20590
RelationshipsChartModule.allAncestors
train
private function allAncestors($xref1, $xref2, $tree_id): array { $ancestors = [ $xref1, $xref2, ]; $queue = [ $xref1, $xref2, ]; while (!empty($queue)) { $parents = DB::table('link AS l1') ->join('li...
php
{ "resource": "" }
q20591
RelationshipsChartModule.excludeFamilies
train
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') ...
php
{ "resource": "" }
q20592
UpgradeService.extractWebtreesZip
train
public function extractWebtreesZip(string $zip_file, string $target_folder): void { // The Flysystem ZIP archive adapter is painfully slow, so use the native PHP library. $zip = new ZipArchive(); if ($zip->open($zip_file)) {
php
{ "resource": "" }
q20593
UpgradeService.webtreesZipContents
train
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))...
php
{ "resource": "" }
q20594
HourglassChartModule.chart
train
protected function chart(Individual $individual, int $generations, bool $show_spouse): ResponseInterface { $this->layout = 'layouts/ajax'; return $this->viewResponse('modules/hourglass-chart/chart', [
php
{ "resource": "" }
q20595
ReportHtml.setup
train
public function setup(): void { parent::setup(); // Setting up the correct dimensions if Portrait (default) or Landscape if ($this->orientation === 'landscape') { $tmpw = $this->page_width; $this->page_width = $this->page_height; $this->page...
php
{ "resource": "" }
q20596
ReportHtml.runPageHeader
train
private function runPageHeader() { foreach ($this->pageHeaderElements as $element) { if ($element instanceof ReportBaseElement) { $element->render($this); } elseif ($element === 'footnotetexts') {
php
{ "resource": "" }
q20597
ReportHtml.createCell
train
public function createCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth): ReportBaseCell { return new ReportHtmlCell($width,
php
{ "resource": "" }
q20598
ReportHtml.createTextBox
train
public function createTextBox( float $width, float $height, bool $border, string $bgcolor, bool $newline, float $left, float $top, bool $pagecheck, string $style, bool $fill, bool
php
{ "resource": "" }
q20599
ReportHtml.addPage
train
public function addPage() { $this->pageN++; // Add a little margin to max Y "between pages" $this->maxY += 10; // If Y is still heigher by any reason... if ($this->maxY < $this->Y) { // ... update max Y
php
{ "resource": "" }