repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
fisharebest/webtrees | app/GedcomTag.php | GedcomTag.getPicklistFacts | 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 | public static function getPicklistFacts($fact_type): array
{
switch ($fact_type) {
case 'INDI':
$tags = [
// Facts, attributes for individuals (no links to FAMs)
'RESN',
'NAME',
'SEX',
... | [
"public",
"static",
"function",
"getPicklistFacts",
"(",
"$",
"fact_type",
")",
":",
"array",
"{",
"switch",
"(",
"$",
"fact_type",
")",
"{",
"case",
"'INDI'",
":",
"$",
"tags",
"=",
"[",
"// Facts, attributes for individuals (no links to FAMs)",
"'RESN'",
",",
... | Get a list of facts, for use in the "fact picker" edit control
@param string $fact_type
@return string[] | [
"Get",
"a",
"list",
"of",
"facts",
"for",
"use",
"in",
"the",
"fact",
"picker",
"edit",
"control"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomTag.php#L2141-L2338 | train |
fisharebest/webtrees | app/GedcomTag.php | GedcomTag.createUid | 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 | 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) {
$... | [
"public",
"static",
"function",
"createUid",
"(",
")",
":",
"string",
"{",
"$",
"uid",
"=",
"str_replace",
"(",
"'-'",
",",
"''",
",",
"Uuid",
"::",
"uuid4",
"(",
")",
"->",
"toString",
"(",
")",
")",
";",
"$",
"checksum_a",
"=",
"0",
";",
"// a su... | 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.
@return string | [
"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",
"... | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomTag.php#L2432-L2446 | train |
fisharebest/webtrees | app/Http/Controllers/Admin/ControlPanelController.php | ControlPanelController.controlPanelManager | 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 | 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... | [
"public",
"function",
"controlPanelManager",
"(",
"ModuleService",
"$",
"module_service",
")",
":",
"ResponseInterface",
"{",
"$",
"all_trees",
"=",
"array_filter",
"(",
"Tree",
"::",
"getAll",
"(",
")",
",",
"static",
"function",
"(",
"Tree",
"$",
"tree",
")"... | Managers see a restricted version of the contol panel.
@param ModuleService $module_service
@return ResponseInterface | [
"Managers",
"see",
"a",
"restricted",
"version",
"of",
"the",
"contol",
"panel",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/Admin/ControlPanelController.php#L144-L167 | train |
fisharebest/webtrees | app/Http/Controllers/Admin/ControlPanelController.php | ControlPanelController.totalChanges | 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');
... | php | 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');
... | [
"private",
"function",
"totalChanges",
"(",
")",
":",
"array",
"{",
"return",
"DB",
"::",
"table",
"(",
"'gedcom'",
")",
"->",
"leftJoin",
"(",
"'change'",
",",
"static",
"function",
"(",
"JoinClause",
"$",
"join",
")",
":",
"void",
"{",
"$",
"join",
"... | Count the number of pending changes in each tree.
@return string[] | [
"Count",
"the",
"number",
"of",
"pending",
"changes",
"in",
"each",
"tree",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/Admin/ControlPanelController.php#L174-L185 | train |
fisharebest/webtrees | app/Http/Controllers/Admin/ControlPanelController.php | ControlPanelController.totalFamilies | 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... | php | 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... | [
"private",
"function",
"totalFamilies",
"(",
")",
":",
"Collection",
"{",
"return",
"DB",
"::",
"table",
"(",
"'gedcom'",
")",
"->",
"leftJoin",
"(",
"'families'",
",",
"'f_file'",
",",
"'='",
",",
"'gedcom_id'",
")",
"->",
"groupBy",
"(",
"'gedcom_id'",
"... | Count the number of families in each tree.
@return Collection
@return int[] | [
"Count",
"the",
"number",
"of",
"families",
"in",
"each",
"tree",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/Admin/ControlPanelController.php#L193-L202 | train |
fisharebest/webtrees | app/Http/Controllers/Admin/ControlPanelController.php | ControlPanelController.totalNotes | 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');
})
->groupB... | php | 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');
})
->groupB... | [
"private",
"function",
"totalNotes",
"(",
")",
":",
"Collection",
"{",
"return",
"DB",
"::",
"table",
"(",
"'gedcom'",
")",
"->",
"leftJoin",
"(",
"'other'",
",",
"static",
"function",
"(",
"JoinClause",
"$",
"join",
")",
":",
"void",
"{",
"$",
"join",
... | Count the number of notes in each tree.
@return Collection
@return int[] | [
"Count",
"the",
"number",
"of",
"notes",
"in",
"each",
"tree",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/Admin/ControlPanelController.php#L244-L257 | train |
fisharebest/webtrees | app/Census/CensusColumnFullName.php | CensusColumnFullName.nameAtCensusDate | 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 | 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->... | [
"protected",
"function",
"nameAtCensusDate",
"(",
"Individual",
"$",
"individual",
",",
"Date",
"$",
"census_date",
")",
":",
"array",
"{",
"$",
"names",
"=",
"$",
"individual",
"->",
"getAllNames",
"(",
")",
";",
"$",
"name",
"=",
"$",
"names",
"[",
"0"... | What was an individual's likely name on a given date, allowing
for marriages and married names.
@param Individual $individual
@param Date $census_date
@return string[] | [
"What",
"was",
"an",
"individual",
"s",
"likely",
"name",
"on",
"a",
"given",
"date",
"allowing",
"for",
"marriages",
"and",
"married",
"names",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Census/CensusColumnFullName.php#L52-L73 | train |
fisharebest/webtrees | app/SurnameTradition.php | SurnameTradition.create | public static function create($name): SurnameTraditionInterface
{
switch ($name) {
case 'paternal':
return new PaternalSurnameTradition();
case 'patrilineal':
return new PatrilinealSurnameTradition();
case 'matrilineal':
ret... | php | public static function create($name): SurnameTraditionInterface
{
switch ($name) {
case 'paternal':
return new PaternalSurnameTradition();
case 'patrilineal':
return new PatrilinealSurnameTradition();
case 'matrilineal':
ret... | [
"public",
"static",
"function",
"create",
"(",
"$",
"name",
")",
":",
"SurnameTraditionInterface",
"{",
"switch",
"(",
"$",
"name",
")",
"{",
"case",
"'paternal'",
":",
"return",
"new",
"PaternalSurnameTradition",
"(",
")",
";",
"case",
"'patrilineal'",
":",
... | Create a surname tradition object for a given surname tradition name.
@param string $name Internal name of the surname tradition
@return SurnameTraditionInterface | [
"Create",
"a",
"surname",
"tradition",
"object",
"for",
"a",
"given",
"surname",
"tradition",
"name",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/SurnameTradition.php#L43-L65 | train |
fisharebest/webtrees | app/Log.php | Log.addConfigurationLog | public static function addConfigurationLog($message, Tree $tree = null): void
{
self::addLog($message, self::TYPE_CONFIGURATION, $tree);
} | php | public static function addConfigurationLog($message, Tree $tree = null): void
{
self::addLog($message, self::TYPE_CONFIGURATION, $tree);
} | [
"public",
"static",
"function",
"addConfigurationLog",
"(",
"$",
"message",
",",
"Tree",
"$",
"tree",
"=",
"null",
")",
":",
"void",
"{",
"self",
"::",
"addLog",
"(",
"$",
"message",
",",
"self",
"::",
"TYPE_CONFIGURATION",
",",
"$",
"tree",
")",
";",
... | Store a configuration message in the message log.
@param string $message
@param Tree|null $tree
@return void | [
"Store",
"a",
"configuration",
"message",
"in",
"the",
"message",
"log",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Log.php#L84-L87 | train |
fisharebest/webtrees | app/Log.php | Log.addEditLog | public static function addEditLog($message, Tree $tree): void
{
self::addLog($message, self::TYPE_EDIT, $tree);
} | php | public static function addEditLog($message, Tree $tree): void
{
self::addLog($message, self::TYPE_EDIT, $tree);
} | [
"public",
"static",
"function",
"addEditLog",
"(",
"$",
"message",
",",
"Tree",
"$",
"tree",
")",
":",
"void",
"{",
"self",
"::",
"addLog",
"(",
"$",
"message",
",",
"self",
"::",
"TYPE_EDIT",
",",
"$",
"tree",
")",
";",
"}"
] | Store an edit message in the message log.
@param string $message
@param Tree $tree
@return void | [
"Store",
"an",
"edit",
"message",
"in",
"the",
"message",
"log",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Log.php#L97-L100 | train |
fisharebest/webtrees | app/Log.php | Log.addSearchLog | public static function addSearchLog($message, array $trees): void
{
foreach ($trees as $tree) {
self::addLog($message, self::TYPE_SEARCH, $tree);
}
} | php | public static function addSearchLog($message, array $trees): void
{
foreach ($trees as $tree) {
self::addLog($message, self::TYPE_SEARCH, $tree);
}
} | [
"public",
"static",
"function",
"addSearchLog",
"(",
"$",
"message",
",",
"array",
"$",
"trees",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"trees",
"as",
"$",
"tree",
")",
"{",
"self",
"::",
"addLog",
"(",
"$",
"message",
",",
"self",
"::",
"TYPE_S... | 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.
@param string $message
@param Tree[] $trees Which trees were searched
@return void | [
"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",
"."
... | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Log.php#L136-L141 | train |
fisharebest/webtrees | app/Module/AbstractModule.php | AbstractModule.getBlockSetting | 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_... | php | 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_... | [
"final",
"protected",
"function",
"getBlockSetting",
"(",
"int",
"$",
"block_id",
",",
"string",
"$",
"setting_name",
",",
"string",
"$",
"default",
"=",
"''",
")",
":",
"string",
"{",
"$",
"settings",
"=",
"app",
"(",
"'cache.array'",
")",
"->",
"remember... | Get a block setting.
Originally, this was just used for the home-page blocks. Now, it is used by any
module that has repeated blocks of content on the same page.
@param int $block_id
@param string $setting_name
@param string $default
@return string | [
"Get",
"a",
"block",
"setting",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/AbstractModule.php#L82-L92 | train |
fisharebest/webtrees | app/Module/AbstractModule.php | AbstractModule.setBlockSetting | 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,
... | php | 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,
... | [
"final",
"protected",
"function",
"setBlockSetting",
"(",
"int",
"$",
"block_id",
",",
"string",
"$",
"setting_name",
",",
"string",
"$",
"setting_value",
")",
":",
"self",
"{",
"DB",
"::",
"table",
"(",
"'block_setting'",
")",
"->",
"updateOrInsert",
"(",
"... | Set a block setting.
@param int $block_id
@param string $setting_name
@param string $setting_value
@return $this | [
"Set",
"a",
"block",
"setting",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/AbstractModule.php#L103-L113 | train |
fisharebest/webtrees | app/Module/AbstractModule.php | AbstractModule.getPreference | 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;
} | php | 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;
} | [
"final",
"public",
"function",
"getPreference",
"(",
"string",
"$",
"setting_name",
",",
"string",
"$",
"default",
"=",
"''",
")",
":",
"string",
"{",
"return",
"DB",
"::",
"table",
"(",
"'module_setting'",
")",
"->",
"where",
"(",
"'module_name'",
",",
"'... | Get a module setting. Return a default if the setting is not set.
@param string $setting_name
@param string $default
@return string | [
"Get",
"a",
"module",
"setting",
".",
"Return",
"a",
"default",
"if",
"the",
"setting",
"is",
"not",
"set",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/AbstractModule.php#L179-L185 | train |
fisharebest/webtrees | app/Module/AbstractModule.php | AbstractModule.setPreference | 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,
]);
} | php | 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,
]);
} | [
"final",
"public",
"function",
"setPreference",
"(",
"string",
"$",
"setting_name",
",",
"string",
"$",
"setting_value",
")",
":",
"void",
"{",
"DB",
"::",
"table",
"(",
"'module_setting'",
")",
"->",
"updateOrInsert",
"(",
"[",
"'module_name'",
"=>",
"$",
"... | Set a module setting.
Since module settings are NOT NULL, setting a value to NULL will cause
it to be deleted.
@param string $setting_name
@param string $setting_value
@return void | [
"Set",
"a",
"module",
"setting",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/AbstractModule.php#L198-L206 | train |
fisharebest/webtrees | app/Module/AbstractModule.php | AbstractModule.accessLevel | 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', '... | php | 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', '... | [
"final",
"public",
"function",
"accessLevel",
"(",
"Tree",
"$",
"tree",
",",
"string",
"$",
"interface",
")",
":",
"int",
"{",
"$",
"access_levels",
"=",
"app",
"(",
"'cache.array'",
")",
"->",
"rememberForever",
"(",
"'module_privacy'",
".",
"$",
"tree",
... | Get a the current access level for a module
@param Tree $tree
@param string $interface
@return int | [
"Get",
"a",
"the",
"current",
"access",
"level",
"for",
"a",
"module"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/AbstractModule.php#L216-L230 | train |
fisharebest/webtrees | app/Http/Controllers/FamilyController.php | FamilyController.show | 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 | 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... | [
"public",
"function",
"show",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"Tree",
"$",
"tree",
",",
"ClipboardService",
"$",
"clipboard_service",
")",
":",
"ResponseInterface",
"{",
"$",
"xref",
"=",
"$",
"request",
"->",
"get",
"(",
"'xref'",
",",
"... | Show a family's page.
@param ServerRequestInterface $request
@param Tree $tree
@param ClipboardService $clipboard_service
@return ResponseInterface | [
"Show",
"a",
"family",
"s",
"page",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/FamilyController.php#L43-L60 | train |
fisharebest/webtrees | app/Functions/Functions.php | Functions.fileUploadErrorText | 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 | 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... | [
"public",
"static",
"function",
"fileUploadErrorText",
"(",
"$",
"error_code",
")",
":",
"string",
"{",
"switch",
"(",
"$",
"error_code",
")",
"{",
"case",
"UPLOAD_ERR_OK",
":",
"return",
"I18N",
"::",
"translate",
"(",
"'File successfully uploaded'",
")",
";",
... | Convert a file upload PHP error code into user-friendly text.
@param int $error_code
@return string | [
"Convert",
"a",
"file",
"upload",
"PHP",
"error",
"code",
"into",
"user",
"-",
"friendly",
"text",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/Functions.php#L38-L65 | train |
fisharebest/webtrees | app/Functions/Functions.php | Functions.getSubRecord | 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 | 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 . "[... | [
"public",
"static",
"function",
"getSubRecord",
"(",
"$",
"level",
",",
"$",
"tag",
",",
"$",
"gedrec",
",",
"$",
"num",
"=",
"1",
")",
":",
"string",
"{",
"if",
"(",
"empty",
"(",
"$",
"gedrec",
")",
")",
"{",
"return",
"''",
";",
"}",
"// -- ad... | get a gedcom subrecord
searches a gedcom record and returns a subrecord of it. A subrecord is defined starting at a
line with level N and all subsequent lines greater than N until the next N level is reached.
For example, the following is a BIRT subrecord:
<code>1 BIRT
2 DATE 1 JAN 1900
2 PLAC Phoenix, Maricopa, Arizo... | [
"get",
"a",
"gedcom",
"subrecord"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/Functions.php#L89-L119 | train |
fisharebest/webtrees | app/Functions/Functions.php | Functions.getCont | 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($t... | php | 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($t... | [
"public",
"static",
"function",
"getCont",
"(",
"$",
"nlevel",
",",
"$",
"nrec",
")",
":",
"string",
"{",
"$",
"text",
"=",
"''",
";",
"$",
"subrecords",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"nrec",
")",
";",
"foreach",
"(",
"$",
"subrecords",
... | get CONT lines
get the N+1 CONT or CONC lines of a gedcom subrecord
@param int $nlevel the level of the CONT lines to get
@param string $nrec the gedcom subrecord to search in
@return string a string with all CONT lines merged | [
"get",
"CONT",
"lines"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/Functions.php#L131-L147 | train |
fisharebest/webtrees | app/Functions/Functions.php | Functions.getCloseRelationshipName | public static function getCloseRelationshipName(Individual $individual1, Individual $individual2): string
{
if ($individual1 === $individual2) {
return self::reflexivePronoun($individual1);
}
try {
$relationship = self::getRelationship($individual1, $individual2);
... | php | public static function getCloseRelationshipName(Individual $individual1, Individual $individual2): string
{
if ($individual1 === $individual2) {
return self::reflexivePronoun($individual1);
}
try {
$relationship = self::getRelationship($individual1, $individual2);
... | [
"public",
"static",
"function",
"getCloseRelationshipName",
"(",
"Individual",
"$",
"individual1",
",",
"Individual",
"$",
"individual2",
")",
":",
"string",
"{",
"if",
"(",
"$",
"individual1",
"===",
"$",
"individual2",
")",
"{",
"return",
"self",
"::",
"refl... | For close family relationships, such as the families tab and the family navigator
Display a tick if both individuals are the same.
@param Individual $individual1
@param Individual $individual2
@return string | [
"For",
"close",
"family",
"relationships",
"such",
"as",
"the",
"families",
"tab",
"and",
"the",
"family",
"navigator",
"Display",
"a",
"tick",
"if",
"both",
"individuals",
"are",
"the",
"same",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/Functions.php#L158-L171 | train |
fisharebest/webtrees | app/Functions/Functions.php | Functions.reflexivePronoun | private static function reflexivePronoun(Individual $individual): string
{
switch ($individual->sex()) {
case 'M':
/* I18N: reflexive pronoun */
return I18N::translate('himself');
case 'F':
/* I18N: reflexive pronoun */
... | php | private static function reflexivePronoun(Individual $individual): string
{
switch ($individual->sex()) {
case 'M':
/* I18N: reflexive pronoun */
return I18N::translate('himself');
case 'F':
/* I18N: reflexive pronoun */
... | [
"private",
"static",
"function",
"reflexivePronoun",
"(",
"Individual",
"$",
"individual",
")",
":",
"string",
"{",
"switch",
"(",
"$",
"individual",
"->",
"sex",
"(",
")",
")",
"{",
"case",
"'M'",
":",
"/* I18N: reflexive pronoun */",
"return",
"I18N",
"::",
... | Generate a reflexive pronoun for an individual
@param Individual $individual
@return string | [
"Generate",
"a",
"reflexive",
"pronoun",
"for",
"an",
"individual"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Functions/Functions.php#L180-L193 | train |
fisharebest/webtrees | app/Http/Controllers/EditGedcomRecordController.php | EditGedcomRecordController.deleteFact | 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 | 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... | [
"public",
"function",
"deleteFact",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"Tree",
"$",
"tree",
")",
":",
"ResponseInterface",
"{",
"$",
"xref",
"=",
"$",
"request",
"->",
"get",
"(",
"'xref'",
",",
"''",
")",
";",
"$",
"fact_id",
"=",
"$",
... | Delete a fact.
@param ServerRequestInterface $request
@param Tree $tree
@return ResponseInterface | [
"Delete",
"a",
"fact",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/EditGedcomRecordController.php#L95-L112 | train |
fisharebest/webtrees | app/Http/Controllers/EditGedcomRecordController.php | EditGedcomRecordController.pasteFact | 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... | php | 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... | [
"public",
"function",
"pasteFact",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"Tree",
"$",
"tree",
",",
"ClipboardService",
"$",
"clipboard_service",
")",
":",
"ResponseInterface",
"{",
"$",
"xref",
"=",
"$",
"request",
"->",
"get",
"(",
"'xref'",
","... | Paste a fact from the clipboard into a record.
@param ServerRequestInterface $request
@param Tree $tree
@param ClipboardService $clipboard_service
@return ResponseInterface | [
"Paste",
"a",
"fact",
"from",
"the",
"clipboard",
"into",
"a",
"record",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/EditGedcomRecordController.php#L176-L188 | train |
fisharebest/webtrees | app/Statistics/Repository/MediaRepository.php | MediaRepository.totalMediaTypeQuery | 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 | 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_... | [
"private",
"function",
"totalMediaTypeQuery",
"(",
"string",
"$",
"type",
")",
":",
"int",
"{",
"if",
"(",
"(",
"$",
"type",
"!==",
"self",
"::",
"MEDIA_TYPE_ALL",
")",
"&&",
"(",
"$",
"type",
"!==",
"self",
"::",
"MEDIA_TYPE_UNKNOWN",
")",
"&&",
"!",
... | Returns the number of media records of the given type.
@param string $type The media type to query
@return int | [
"Returns",
"the",
"number",
"of",
"media",
"records",
"of",
"the",
"given",
"type",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics/Repository/MediaRepository.php#L107-L139 | train |
fisharebest/webtrees | app/Statistics/Repository/MediaRepository.php | MediaRepository.getSortedMediaTypeList | 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 | 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 (... | [
"private",
"function",
"getSortedMediaTypeList",
"(",
"int",
"$",
"tot",
")",
":",
"array",
"{",
"$",
"media",
"=",
"[",
"]",
";",
"$",
"c",
"=",
"0",
";",
"$",
"max",
"=",
"0",
";",
"foreach",
"(",
"self",
"::",
"MEDIA_TYPES",
"as",
"$",
"type",
... | Returns a sorted list of media types and their total counts.
@param int $tot The total number of media files
@return array | [
"Returns",
"a",
"sorted",
"list",
"of",
"media",
"types",
"and",
"their",
"total",
"counts",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics/Repository/MediaRepository.php#L308-L355 | train |
fisharebest/webtrees | app/Http/Controllers/IndividualController.php | IndividualController.formatSexRecord | 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 | 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;... | [
"private",
"function",
"formatSexRecord",
"(",
"Fact",
"$",
"fact",
")",
":",
"string",
"{",
"$",
"individual",
"=",
"$",
"fact",
"->",
"record",
"(",
")",
";",
"switch",
"(",
"$",
"fact",
"->",
"value",
"(",
")",
")",
"{",
"case",
"'M'",
":",
"$",... | print information for a sex record
@param Fact $fact
@return string | [
"print",
"information",
"for",
"a",
"sex",
"record"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/IndividualController.php#L296-L333 | train |
fisharebest/webtrees | app/Report/ReportHtmlText.php | ReportHtmlText.getWidth | 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 | 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... | [
"public",
"function",
"getWidth",
"(",
"$",
"renderer",
")",
"{",
"// Setup the style name, a font must be selected to calculate the width",
"if",
"(",
"$",
"renderer",
"->",
"getCurrentStyle",
"(",
")",
"!=",
"$",
"this",
"->",
"styleName",
")",
"{",
"$",
"renderer... | Get the width of text and wrap it too
@param ReportHtml $renderer
@return float|array | [
"Get",
"the",
"width",
"of",
"text",
"and",
"wrap",
"it",
"too"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportHtmlText.php#L110-L196 | train |
fisharebest/webtrees | app/Services/TimeoutService.php | TimeoutService.isTimeNearlyUp | 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 false;
}
$now = micr... | php | 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 false;
}
$now = micr... | [
"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, ... | Some long-running scripts need to know when to stop.
@param float $threshold
@return bool | [
"Some",
"long",
"-",
"running",
"scripts",
"need",
"to",
"know",
"when",
"to",
"stop",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/TimeoutService.php#L54-L66 | train |
fisharebest/webtrees | app/Services/TimeoutService.php | TimeoutService.isTimeLimitUp | public function isTimeLimitUp(float $limit = self::TIME_LIMIT): bool
{
$now = microtime(true);
return $now > $this->start_time + $limit;
} | php | public function isTimeLimitUp(float $limit = self::TIME_LIMIT): bool
{
$now = microtime(true);
return $now > $this->start_time + $limit;
} | [
"public",
"function",
"isTimeLimitUp",
"(",
"float",
"$",
"limit",
"=",
"self",
"::",
"TIME_LIMIT",
")",
":",
"bool",
"{",
"$",
"now",
"=",
"microtime",
"(",
"true",
")",
";",
"return",
"$",
"now",
">",
"$",
"this",
"->",
"start_time",
"+",
"$",
"lim... | Some long running scripts are broken down into small chunks.
@param float $limit
@return bool | [
"Some",
"long",
"running",
"scripts",
"are",
"broken",
"down",
"into",
"small",
"chunks",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/TimeoutService.php#L75-L80 | train |
fisharebest/webtrees | app/I18N.php | I18N.activeLocales | public static function activeLocales(): array
{
$locales = app(ModuleService::class)
->findByInterface(ModuleLanguageInterface::class, false, true)
->map(static function (ModuleLanguageInterface $module): LocaleInterface {
return $module->locale();
});
... | php | public static function activeLocales(): array
{
$locales = app(ModuleService::class)
->findByInterface(ModuleLanguageInterface::class, false, true)
->map(static function (ModuleLanguageInterface $module): LocaleInterface {
return $module->locale();
});
... | [
"public",
"static",
"function",
"activeLocales",
"(",
")",
":",
"array",
"{",
"$",
"locales",
"=",
"app",
"(",
"ModuleService",
"::",
"class",
")",
"->",
"findByInterface",
"(",
"ModuleLanguageInterface",
"::",
"class",
",",
"false",
",",
"true",
")",
"->",
... | The preferred locales for this site, or a default list if no preference.
@return LocaleInterface[] | [
"The",
"preferred",
"locales",
"for",
"this",
"site",
"or",
"a",
"default",
"list",
"if",
"no",
"preference",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/I18N.php#L216-L229 | train |
fisharebest/webtrees | app/I18N.php | I18N.installedLocales | public static function installedLocales(): Collection
{
return app(ModuleService::class)
->findByInterface(ModuleLanguageInterface::class, true)
->map(static function (ModuleLanguageInterface $module): LocaleInterface {
return $module->locale();
});
} | php | public static function installedLocales(): Collection
{
return app(ModuleService::class)
->findByInterface(ModuleLanguageInterface::class, true)
->map(static function (ModuleLanguageInterface $module): LocaleInterface {
return $module->locale();
});
} | [
"public",
"static",
"function",
"installedLocales",
"(",
")",
":",
"Collection",
"{",
"return",
"app",
"(",
"ModuleService",
"::",
"class",
")",
"->",
"findByInterface",
"(",
"ModuleLanguageInterface",
"::",
"class",
",",
"true",
")",
"->",
"map",
"(",
"static... | All locales for which a translation file exists.
@return Collection
@return LocaleInterface[] | [
"All",
"locales",
"for",
"which",
"a",
"translation",
"file",
"exists",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/I18N.php#L407-L414 | train |
fisharebest/webtrees | app/I18N.php | I18N.strcasecmp | 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));
} | php | 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));
} | [
"public",
"static",
"function",
"strcasecmp",
"(",
"$",
"string1",
",",
"$",
"string2",
")",
":",
"int",
"{",
"if",
"(",
"self",
"::",
"$",
"collator",
"instanceof",
"Collator",
")",
"{",
"return",
"self",
"::",
"$",
"collator",
"->",
"compare",
"(",
"... | Perform a case-insensitive comparison of two strings.
@param string $string1
@param string $string2
@return int | [
"Perform",
"a",
"case",
"-",
"insensitive",
"comparison",
"of",
"two",
"strings",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/I18N.php#L566-L573 | train |
fisharebest/webtrees | app/I18N.php | I18N.strtolower | 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);
} | php | 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);
} | [
"public",
"static",
"function",
"strtolower",
"(",
"$",
"string",
")",
":",
"string",
"{",
"if",
"(",
"in_array",
"(",
"self",
"::",
"$",
"locale",
"->",
"language",
"(",
")",
"->",
"code",
"(",
")",
",",
"self",
"::",
"DOTLESS_I_LOCALES",
",",
"true",... | Convert a string to lower case.
@param string $string
@return string | [
"Convert",
"a",
"string",
"to",
"lower",
"case",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/I18N.php#L582-L589 | train |
fisharebest/webtrees | app/I18N.php | I18N.strtoupper | 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);
} | php | 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);
} | [
"public",
"static",
"function",
"strtoupper",
"(",
"$",
"string",
")",
":",
"string",
"{",
"if",
"(",
"in_array",
"(",
"self",
"::",
"$",
"locale",
"->",
"language",
"(",
")",
"->",
"code",
"(",
")",
",",
"self",
"::",
"DOTLESS_I_LOCALES",
",",
"true",... | Convert a string to upper case.
@param string $string
@return string | [
"Convert",
"a",
"string",
"to",
"upper",
"case",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/I18N.php#L598-L605 | train |
fisharebest/webtrees | app/I18N.php | I18N.textScript | 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 | 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.'... | [
"public",
"static",
"function",
"textScript",
"(",
"$",
"string",
")",
":",
"string",
"{",
"$",
"string",
"=",
"strip_tags",
"(",
"$",
"string",
")",
";",
"// otherwise HTML tags show up as latin",
"$",
"string",
"=",
"html_entity_decode",
"(",
"$",
"string",
... | Identify the script used for a piece of text
@param string $string
@return string | [
"Identify",
"the",
"script",
"used",
"for",
"a",
"piece",
"of",
"text"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/I18N.php#L614-L657 | train |
fisharebest/webtrees | app/Services/UserService.php | UserService.find | 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())
... | php | 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())
... | [
"public",
"function",
"find",
"(",
"$",
"user_id",
")",
":",
"?",
"User",
"{",
"return",
"app",
"(",
"'cache.array'",
")",
"->",
"rememberForever",
"(",
"__CLASS__",
".",
"$",
"user_id",
",",
"static",
"function",
"(",
")",
"use",
"(",
"$",
"user_id",
... | Find the user with a specified user_id.
@param int|null $user_id
@return User|null | [
"Find",
"the",
"user",
"with",
"a",
"specified",
"user_id",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/UserService.php#L43-L52 | train |
fisharebest/webtrees | app/Services/UserService.php | UserService.findByEmail | public function findByEmail($email): ?User
{
return DB::table('user')
->where('email', '=', $email)
->get()
->map(User::rowMapper())
->first();
} | php | public function findByEmail($email): ?User
{
return DB::table('user')
->where('email', '=', $email)
->get()
->map(User::rowMapper())
->first();
} | [
"public",
"function",
"findByEmail",
"(",
"$",
"email",
")",
":",
"?",
"User",
"{",
"return",
"DB",
"::",
"table",
"(",
"'user'",
")",
"->",
"where",
"(",
"'email'",
",",
"'='",
",",
"$",
"email",
")",
"->",
"get",
"(",
")",
"->",
"map",
"(",
"Us... | Find the user with a specified email address.
@param string $email
@return User|null | [
"Find",
"the",
"user",
"with",
"a",
"specified",
"email",
"address",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/UserService.php#L61-L68 | train |
fisharebest/webtrees | app/Services/UserService.php | UserService.findByIdentifier | public function findByIdentifier($identifier): ?User
{
return DB::table('user')
->where('user_name', '=', $identifier)
->orWhere('email', '=', $identifier)
->get()
->map(User::rowMapper())
->first();
} | php | public function findByIdentifier($identifier): ?User
{
return DB::table('user')
->where('user_name', '=', $identifier)
->orWhere('email', '=', $identifier)
->get()
->map(User::rowMapper())
->first();
} | [
"public",
"function",
"findByIdentifier",
"(",
"$",
"identifier",
")",
":",
"?",
"User",
"{",
"return",
"DB",
"::",
"table",
"(",
"'user'",
")",
"->",
"where",
"(",
"'user_name'",
",",
"'='",
",",
"$",
"identifier",
")",
"->",
"orWhere",
"(",
"'email'",
... | Find the user with a specified user_name or email address.
@param string $identifier
@return User|null | [
"Find",
"the",
"user",
"with",
"a",
"specified",
"user_name",
"or",
"email",
"address",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/UserService.php#L77-L85 | train |
fisharebest/webtrees | app/Services/UserService.php | UserService.findByUserName | public function findByUserName($user_name): ?User
{
return DB::table('user')
->where('user_name', '=', $user_name)
->get()
->map(User::rowMapper())
->first();
} | php | public function findByUserName($user_name): ?User
{
return DB::table('user')
->where('user_name', '=', $user_name)
->get()
->map(User::rowMapper())
->first();
} | [
"public",
"function",
"findByUserName",
"(",
"$",
"user_name",
")",
":",
"?",
"User",
"{",
"return",
"DB",
"::",
"table",
"(",
"'user'",
")",
"->",
"where",
"(",
"'user_name'",
",",
"'='",
",",
"$",
"user_name",
")",
"->",
"get",
"(",
")",
"->",
"map... | Find the user with a specified user_name.
@param string $user_name
@return User|null | [
"Find",
"the",
"user",
"with",
"a",
"specified",
"user_name",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/UserService.php#L114-L121 | train |
fisharebest/webtrees | app/Services/UserService.php | UserService.administrators | 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 | 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... | [
"public",
"function",
"administrators",
"(",
")",
":",
"Collection",
"{",
"return",
"DB",
"::",
"table",
"(",
"'user'",
")",
"->",
"join",
"(",
"'user_setting'",
",",
"static",
"function",
"(",
"JoinClause",
"$",
"join",
")",
":",
"void",
"{",
"$",
"join... | Get a list of all administrators.
@return Collection
@return User[] | [
"Get",
"a",
"list",
"of",
"all",
"administrators",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/UserService.php#L144-L158 | train |
fisharebest/webtrees | app/Services/UserService.php | UserService.allLoggedIn | 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()
... | php | 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()
... | [
"public",
"function",
"allLoggedIn",
"(",
")",
":",
"Collection",
"{",
"return",
"DB",
"::",
"table",
"(",
"'user'",
")",
"->",
"join",
"(",
"'session'",
",",
"'session.user_id'",
",",
"'='",
",",
"'user.user_id'",
")",
"->",
"where",
"(",
"'user.user_id'",
... | Get a list of all users who are currently logged in.
@return Collection
@return User[] | [
"Get",
"a",
"list",
"of",
"all",
"users",
"who",
"are",
"currently",
"logged",
"in",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/UserService.php#L254-L264 | train |
fisharebest/webtrees | app/Services/UserService.php | UserService.create | 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_DEFA... | php | 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_DEFA... | [
"public",
"function",
"create",
"(",
"string",
"$",
"user_name",
",",
"string",
"$",
"real_name",
",",
"string",
"$",
"email",
",",
"string",
"$",
"password",
")",
":",
"User",
"{",
"DB",
"::",
"table",
"(",
"'user'",
")",
"->",
"insert",
"(",
"[",
"... | Create a new user.
The calling code needs to check for duplicates identifiers before calling
this function.
@param string $user_name
@param string $real_name
@param string $email
@param string $password
@return User | [
"Create",
"a",
"new",
"user",
".",
"The",
"calling",
"code",
"needs",
"to",
"check",
"for",
"duplicates",
"identifiers",
"before",
"calling",
"this",
"function",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/UserService.php#L278-L290 | train |
fisharebest/webtrees | app/Statistics/Repository/PlaceRepository.php | PlaceRepository.statsPlaces | 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 | 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 $... | [
"public",
"function",
"statsPlaces",
"(",
"string",
"$",
"what",
"=",
"'ALL'",
",",
"string",
"$",
"fact",
"=",
"''",
",",
"int",
"$",
"parent",
"=",
"0",
",",
"bool",
"$",
"country",
"=",
"false",
")",
":",
"array",
"{",
"if",
"(",
"$",
"fact",
... | Query places.
@param string $what
@param string $fact
@param int $parent
@param bool $country
@return int[]|stdClass[] | [
"Query",
"places",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics/Repository/PlaceRepository.php#L125-L166 | train |
fisharebest/webtrees | app/Statistics/Repository/PlaceRepository.php | PlaceRepository.getTop10Places | 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' => $cou... | php | 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' => $cou... | [
"private",
"function",
"getTop10Places",
"(",
"array",
"$",
"places",
")",
":",
"array",
"{",
"$",
"top10",
"=",
"[",
"]",
";",
"$",
"i",
"=",
"0",
";",
"arsort",
"(",
"$",
"places",
")",
";",
"foreach",
"(",
"$",
"places",
"as",
"$",
"place",
"=... | Get the top 10 places list.
@param array $places
@return array | [
"Get",
"the",
"top",
"10",
"places",
"list",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics/Repository/PlaceRepository.php#L175-L197 | train |
fisharebest/webtrees | app/Statistics/Repository/PlaceRepository.php | PlaceRepository.commonCountriesList | 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 | 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... | [
"public",
"function",
"commonCountriesList",
"(",
")",
":",
"string",
"{",
"$",
"countries",
"=",
"$",
"this",
"->",
"statsPlaces",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"countries",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"top10",
"=",
... | A list of common countries.
@return string | [
"A",
"list",
"of",
"common",
"countries",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics/Repository/PlaceRepository.php#L256-L316 | train |
fisharebest/webtrees | app/Report/AbstractReport.php | AbstractReport.setup | public function setup(): void
{
$this->rtl = I18N::direction() === 'rtl';
$this->rkeywords = '';
// I18N: This is a report footer. %s is the name of the application.
$this->generated_by = I18N::translate('Generated by %s', Webtrees::NAME . ' ' . Webtrees::VERSION);
// Pape... | php | public function setup(): void
{
$this->rtl = I18N::direction() === 'rtl';
$this->rkeywords = '';
// I18N: This is a report footer. %s is the name of the application.
$this->generated_by = I18N::translate('Generated by %s', Webtrees::NAME . ' ' . Webtrees::VERSION);
// Pape... | [
"public",
"function",
"setup",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"rtl",
"=",
"I18N",
"::",
"direction",
"(",
")",
"===",
"'rtl'",
";",
"$",
"this",
"->",
"rkeywords",
"=",
"''",
";",
"// I18N: This is a report footer. %s is the name of the applica... | 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
@return void | [
"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"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/AbstractReport.php#L277-L288 | train |
fisharebest/webtrees | app/Report/AbstractReport.php | AbstractReport.getStyle | public function getStyle(string $s): array
{
if (!isset($this->styles[$s])) {
return current($this->styles);
}
return $this->styles[$s];
} | php | public function getStyle(string $s): array
{
if (!isset($this->styles[$s])) {
return current($this->styles);
}
return $this->styles[$s];
} | [
"public",
"function",
"getStyle",
"(",
"string",
"$",
"s",
")",
":",
"array",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"styles",
"[",
"$",
"s",
"]",
")",
")",
"{",
"return",
"current",
"(",
"$",
"this",
"->",
"styles",
")",
";",
"}... | Get a style from the Styles array
@param string $s Style name
@return array | [
"Get",
"a",
"style",
"from",
"the",
"Styles",
"array"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/AbstractReport.php#L345-L352 | train |
fisharebest/webtrees | app/Http/Middleware/UpdateDatabaseSchema.php | UpdateDatabaseSchema.process | 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);
} | php | 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);
} | [
"public",
"function",
"process",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"RequestHandlerInterface",
"$",
"handler",
")",
":",
"ResponseInterface",
"{",
"$",
"this",
"->",
"migration_service",
"->",
"updateSchema",
"(",
"'\\Fisharebest\\Webtrees\\Schema'",
",... | Update the database schema, if necessary.
@param ServerRequestInterface $request
@param RequestHandlerInterface $handler
@return ResponseInterface | [
"Update",
"the",
"database",
"schema",
"if",
"necessary",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Middleware/UpdateDatabaseSchema.php#L51-L57 | train |
fisharebest/webtrees | app/Http/Controllers/AdminSiteController.php | AdminSiteController.cleanData | public function cleanData(ServerRequestInterface $request, FilesystemInterface $filesystem): ResponseInterface
{
$protected = [
'.htaccess',
'.gitignore',
'index.php',
'config.ini.php',
];
if ($request->getAttribute('dbtype') === 'sqlite') {
... | php | public function cleanData(ServerRequestInterface $request, FilesystemInterface $filesystem): ResponseInterface
{
$protected = [
'.htaccess',
'.gitignore',
'index.php',
'config.ini.php',
];
if ($request->getAttribute('dbtype') === 'sqlite') {
... | [
"public",
"function",
"cleanData",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"FilesystemInterface",
"$",
"filesystem",
")",
":",
"ResponseInterface",
"{",
"$",
"protected",
"=",
"[",
"'.htaccess'",
",",
"'.gitignore'",
",",
"'index.php'",
",",
"'config.ini... | Show old user files in the data folder.
@param ServerRequestInterface $request
@param FilesystemInterface $filesystem
@return ResponseInterface | [
"Show",
"old",
"user",
"files",
"in",
"the",
"data",
"folder",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/AdminSiteController.php#L78-L109 | train |
fisharebest/webtrees | app/Http/Controllers/AdminSiteController.php | AdminSiteController.cleanDataAction | 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 | 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... | [
"public",
"function",
"cleanDataAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"FilesystemInterface",
"$",
"filesystem",
")",
":",
"ResponseInterface",
"{",
"$",
"to_delete",
"=",
"(",
"array",
")",
"$",
"request",
"->",
"get",
"(",
"'to_delete'",
... | Delete old user files in the data folder.
@param ServerRequestInterface $request
@param FilesystemInterface $filesystem
@return ResponseInterface | [
"Delete",
"old",
"user",
"files",
"in",
"the",
"data",
"folder",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/AdminSiteController.php#L119-L154 | train |
fisharebest/webtrees | app/Http/Controllers/AdminSiteController.php | AdminSiteController.logsQuery | 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 | 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... | [
"private",
"function",
"logsQuery",
"(",
"ServerRequestInterface",
"$",
"request",
")",
":",
"Builder",
"{",
"$",
"from",
"=",
"$",
"request",
"->",
"get",
"(",
"'from'",
")",
";",
"$",
"to",
"=",
"$",
"request",
"->",
"get",
"(",
"'to'",
")",
";",
"... | Generate a query for filtering the site log.
@param ServerRequestInterface $request
@return Builder | [
"Generate",
"a",
"query",
"for",
"filtering",
"the",
"site",
"log",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/AdminSiteController.php#L240-L285 | train |
fisharebest/webtrees | app/Http/Controllers/AdminSiteController.php | AdminSiteController.serverInformation | 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... | php | 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... | [
"public",
"function",
"serverInformation",
"(",
")",
":",
"ResponseInterface",
"{",
"ob_start",
"(",
")",
";",
"phpinfo",
"(",
"INFO_ALL",
"&",
"~",
"INFO_CREDITS",
"&",
"~",
"INFO_LICENSE",
")",
";",
"$",
"phpinfo",
"=",
"ob_get_clean",
"(",
")",
";",
"pr... | Show the server information page.
@return ResponseInterface | [
"Show",
"the",
"server",
"information",
"page",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/AdminSiteController.php#L513-L525 | train |
fisharebest/webtrees | app/Module/ContactsFooterModule.php | ContactsFooterModule.contactLinkTechnical | public function contactLinkTechnical(User $user): string
{
return I18N::translate('For technical support and information contact %s.', $this->user_service->contactLink($user));
} | php | public function contactLinkTechnical(User $user): string
{
return I18N::translate('For technical support and information contact %s.', $this->user_service->contactLink($user));
} | [
"public",
"function",
"contactLinkTechnical",
"(",
"User",
"$",
"user",
")",
":",
"string",
"{",
"return",
"I18N",
"::",
"translate",
"(",
"'For technical support and information contact %s.'",
",",
"$",
"this",
"->",
"user_service",
"->",
"contactLink",
"(",
"$",
... | Create contact link for technical support.
@param User $user
@return string | [
"Create",
"contact",
"link",
"for",
"technical",
"support",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/ContactsFooterModule.php#L153-L156 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.nameComparator | 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 | 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... | [
"public",
"static",
"function",
"nameComparator",
"(",
")",
":",
"Closure",
"{",
"return",
"static",
"function",
"(",
"GedcomRecord",
"$",
"x",
",",
"GedcomRecord",
"$",
"y",
")",
":",
"int",
"{",
"if",
"(",
"$",
"x",
"->",
"canShowName",
"(",
")",
")"... | A closure which will compare records by name.
@return Closure | [
"A",
"closure",
"which",
"will",
"compare",
"records",
"by",
"name",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L116-L133 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.lastChangeComparator | public static function lastChangeComparator(int $direction = 1): Closure
{
return static function (GedcomRecord $x, GedcomRecord $y) use ($direction): int {
return $direction * ($x->lastChangeTimestamp() <=> $y->lastChangeTimestamp());
};
} | php | public static function lastChangeComparator(int $direction = 1): Closure
{
return static function (GedcomRecord $x, GedcomRecord $y) use ($direction): int {
return $direction * ($x->lastChangeTimestamp() <=> $y->lastChangeTimestamp());
};
} | [
"public",
"static",
"function",
"lastChangeComparator",
"(",
"int",
"$",
"direction",
"=",
"1",
")",
":",
"Closure",
"{",
"return",
"static",
"function",
"(",
"GedcomRecord",
"$",
"x",
",",
"GedcomRecord",
"$",
"y",
")",
"use",
"(",
"$",
"direction",
")",
... | A closure which will compare records by change time.
@param int $direction +1 to sort ascending, -1 to sort descending
@return Closure | [
"A",
"closure",
"which",
"will",
"compare",
"records",
"by",
"change",
"time",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L142-L147 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.parseFacts | 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 | 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) {
... | [
"private",
"function",
"parseFacts",
"(",
")",
":",
"void",
"{",
"// Split the record into facts",
"if",
"(",
"$",
"this",
"->",
"gedcom",
")",
"{",
"$",
"gedcom_facts",
"=",
"preg_split",
"(",
"'/\\n(?=1)/s'",
",",
"$",
"this",
"->",
"gedcom",
")",
";",
"... | Split the record into facts
@return void | [
"Split",
"the",
"record",
"into",
"facts"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L154-L186 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.canShowRecord | 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 | 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... | [
"private",
"function",
"canShowRecord",
"(",
"int",
"$",
"access_level",
")",
":",
"bool",
"{",
"// This setting would better be called \"$ENABLE_PRIVACY\"",
"if",
"(",
"!",
"$",
"this",
"->",
"tree",
"->",
"getPreference",
"(",
"'HIDE_LIVE_PEOPLE'",
")",
")",
"{",
... | Work out whether this record can be shown to a user with a given access level
@param int $access_level
@return bool | [
"Work",
"out",
"whether",
"this",
"record",
"can",
"be",
"shown",
"to",
"a",
"user",
"with",
"a",
"given",
"access",
"level"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L405-L441 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.canShow | 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 | 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) ... | [
"public",
"function",
"canShow",
"(",
"int",
"$",
"access_level",
"=",
"null",
")",
":",
"bool",
"{",
"$",
"access_level",
"=",
"$",
"access_level",
"??",
"Auth",
"::",
"accessLevel",
"(",
"$",
"this",
"->",
"tree",
")",
";",
"// We use this value to bypass ... | Can the details of this record be shown?
@param int|null $access_level
@return bool | [
"Can",
"the",
"details",
"of",
"this",
"record",
"be",
"shown?"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L470-L485 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.privatizeGedcom | 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 | 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)) {
... | [
"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",
"r... | Remove private data from the raw gedcom record.
Return both the visible and invisible data. We need the invisible data when editing.
@param int $access_level
@return string | [
"Remove",
"private",
"data",
"from",
"the",
"raw",
"gedcom",
"record",
".",
"Return",
"both",
"the",
"visible",
"and",
"invisible",
"data",
".",
"We",
"need",
"the",
"invisible",
"data",
"when",
"editing",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L525-L549 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.alternateName | public function alternateName(): ?string
{
if ($this->canShowName() && $this->getPrimaryName() !== $this->getSecondaryName()) {
$all_names = $this->getAllNames();
return $all_names[$this->getSecondaryName()]['full'];
}
return null;
} | php | public function alternateName(): ?string
{
if ($this->canShowName() && $this->getPrimaryName() !== $this->getSecondaryName()) {
$all_names = $this->getAllNames();
return $all_names[$this->getSecondaryName()]['full'];
}
return null;
} | [
"public",
"function",
"alternateName",
"(",
")",
":",
"?",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"canShowName",
"(",
")",
"&&",
"$",
"this",
"->",
"getPrimaryName",
"(",
")",
"!==",
"$",
"this",
"->",
"getSecondaryName",
"(",
")",
")",
"{",
"$... | Get the full name in an alternative character set
@return string|null | [
"Get",
"the",
"full",
"name",
"in",
"an",
"alternative",
"character",
"set"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L781-L790 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.formatList | 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;
} | php | 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;
} | [
"public",
"function",
"formatList",
"(",
")",
":",
"string",
"{",
"$",
"html",
"=",
"'<a href=\"'",
".",
"e",
"(",
"$",
"this",
"->",
"url",
"(",
")",
")",
".",
"'\" class=\"list_item\">'",
";",
"$",
"html",
".=",
"'<b>'",
".",
"$",
"this",
"->",
"fu... | Format this object for display in a list
@return string | [
"Format",
"this",
"object",
"for",
"display",
"in",
"a",
"list"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L797-L805 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.linkedRepositories | 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 | 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())
... | [
"public",
"function",
"linkedRepositories",
"(",
"string",
"$",
"link",
")",
":",
"array",
"{",
"$",
"rows",
"=",
"DB",
"::",
"table",
"(",
"'other'",
")",
"->",
"join",
"(",
"'link'",
",",
"static",
"function",
"(",
"JoinClause",
"$",
"join",
")",
":"... | Find repositories linked to this record.
@param string $link
@return Repository[] | [
"Find",
"repositories",
"linked",
"to",
"this",
"record",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L1006-L1028 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.getAllEventPlaces | 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) {
... | php | 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) {
... | [
"public",
"function",
"getAllEventPlaces",
"(",
"array",
"$",
"events",
")",
":",
"array",
"{",
"$",
"places",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"facts",
"(",
"$",
"events",
")",
"as",
"$",
"event",
")",
"{",
"if",
"(",
"preg_m... | Get all the places for a particular type of event
@param string[] $events
@return Place[] | [
"Get",
"all",
"the",
"places",
"for",
"a",
"particular",
"type",
"of",
"event"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L1060-L1072 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.facts | 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 | 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) || $... | [
"public",
"function",
"facts",
"(",
"array",
"$",
"filter",
"=",
"[",
"]",
",",
"bool",
"$",
"sort",
"=",
"false",
",",
"int",
"$",
"access_level",
"=",
"null",
",",
"bool",
"$",
"override",
"=",
"false",
")",
":",
"Collection",
"{",
"if",
"(",
"$"... | The facts and events for this record.
@param string[] $filter
@param bool $sort
@param int|null $access_level
@param bool $override Include private records, to allow us to implement $SHOW_PRIVATE_RELATIONSHIPS and $SHOW_LIVING_NAMES.
@return Collection
@return Fact[] | [
"The",
"facts",
"and",
"events",
"for",
"this",
"record",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L1085-L1105 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.lastChangeTimestamp | 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 | 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... | [
"public",
"function",
"lastChangeTimestamp",
"(",
")",
":",
"Carbon",
"{",
"/** @var Fact|null $chan */",
"$",
"chan",
"=",
"$",
"this",
"->",
"facts",
"(",
"[",
"'CHAN'",
"]",
")",
"->",
"first",
"(",
")",
";",
"if",
"(",
"$",
"chan",
"instanceof",
"Fac... | Get the last-change timestamp for this record
@return Carbon | [
"Get",
"the",
"last",
"-",
"change",
"timestamp",
"for",
"this",
"record"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L1112-L1134 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.lastChangeUser | 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');
... | php | 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');
... | [
"public",
"function",
"lastChangeUser",
"(",
")",
":",
"string",
"{",
"$",
"chan",
"=",
"$",
"this",
"->",
"facts",
"(",
"[",
"'CHAN'",
"]",
")",
"->",
"first",
"(",
")",
";",
"if",
"(",
"$",
"chan",
"===",
"null",
")",
"{",
"return",
"I18N",
"::... | Get the last-change user for this record
@return string | [
"Get",
"the",
"last",
"-",
"change",
"user",
"for",
"this",
"record"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L1141-L1155 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.createFact | public function createFact(string $gedcom, bool $update_chan): void
{
$this->updateFact('', $gedcom, $update_chan);
} | php | public function createFact(string $gedcom, bool $update_chan): void
{
$this->updateFact('', $gedcom, $update_chan);
} | [
"public",
"function",
"createFact",
"(",
"string",
"$",
"gedcom",
",",
"bool",
"$",
"update_chan",
")",
":",
"void",
"{",
"$",
"this",
"->",
"updateFact",
"(",
"''",
",",
"$",
"gedcom",
",",
"$",
"update_chan",
")",
";",
"}"
] | Add a new fact to this record
@param string $gedcom
@param bool $update_chan
@return void | [
"Add",
"a",
"new",
"fact",
"to",
"this",
"record"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L1165-L1168 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.deleteFact | public function deleteFact(string $fact_id, bool $update_chan): void
{
$this->updateFact($fact_id, '', $update_chan);
} | php | public function deleteFact(string $fact_id, bool $update_chan): void
{
$this->updateFact($fact_id, '', $update_chan);
} | [
"public",
"function",
"deleteFact",
"(",
"string",
"$",
"fact_id",
",",
"bool",
"$",
"update_chan",
")",
":",
"void",
"{",
"$",
"this",
"->",
"updateFact",
"(",
"$",
"fact_id",
",",
"''",
",",
"$",
"update_chan",
")",
";",
"}"
] | Delete a fact from this record
@param string $fact_id
@param bool $update_chan
@return void | [
"Delete",
"a",
"fact",
"from",
"this",
"record"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L1178-L1181 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.updateFact | 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 | 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('... | [
"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]+... | Replace a fact with a new gedcom data.
@param string $fact_id
@param string $gedcom
@param bool $update_chan
@return void
@throws Exception | [
"Replace",
"a",
"fact",
"with",
"a",
"new",
"gedcom",
"data",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L1193-L1256 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.updateRecord | 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 | 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... | [
"public",
"function",
"updateRecord",
"(",
"string",
"$",
"gedcom",
",",
"bool",
"$",
"update_chan",
")",
":",
"void",
"{",
"// MSDOS line endings will break things in horrible ways",
"$",
"gedcom",
"=",
"preg_replace",
"(",
"'/[\\r\\n]+/'",
",",
"\"\\n\"",
",",
"$"... | Update this record
@param string $gedcom
@param bool $update_chan
@return void | [
"Update",
"this",
"record"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L1266-L1300 | train |
fisharebest/webtrees | app/GedcomRecord.php | GedcomRecord.linkingRecords | 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 | 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']);
... | [
"public",
"function",
"linkingRecords",
"(",
")",
":",
"array",
"{",
"$",
"union",
"=",
"DB",
"::",
"table",
"(",
"'change'",
")",
"->",
"where",
"(",
"'gedcom_id'",
",",
"'='",
",",
"$",
"this",
"->",
"tree",
"(",
")",
"->",
"id",
"(",
")",
")",
... | Fetch XREFs of all records linked to a record - when deleting an object, we must
also delete all links to it.
@return GedcomRecord[] | [
"Fetch",
"XREFs",
"of",
"all",
"records",
"linked",
"to",
"a",
"record",
"-",
"when",
"deleting",
"an",
"object",
"we",
"must",
"also",
"delete",
"all",
"links",
"to",
"it",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/GedcomRecord.php#L1365-L1383 | train |
fisharebest/webtrees | app/Statistics/Google/ChartSex.php | ChartSex.chartSex | 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 | 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';
... | [
"public",
"function",
"chartSex",
"(",
"int",
"$",
"tot_m",
",",
"int",
"$",
"tot_f",
",",
"int",
"$",
"tot_u",
",",
"string",
"$",
"color_female",
"=",
"null",
",",
"string",
"$",
"color_male",
"=",
"null",
",",
"string",
"$",
"color_unknown",
"=",
"n... | Generate a chart showing sex distribution.
@param int $tot_m The total number of male individuals
@param int $tot_f The total number of female individuals
@param int $tot_u The total number of unknown individuals
@param string|null $color_female
@param string|null $color... | [
"Generate",
"a",
"chart",
"showing",
"sex",
"distribution",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Statistics/Google/ChartSex.php#L39-L84 | train |
fisharebest/webtrees | app/Http/Controllers/EditNoteController.php | EditNoteController.createNoteObjectAction | 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 | public function createNoteObjectAction(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$note = $request->get('note', '');
$privacy_restriction = $request->get('privacy-restriction', '');
$edit_restriction = $request->get('edit-restriction', '');
/... | [
"public",
"function",
"createNoteObjectAction",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"Tree",
"$",
"tree",
")",
":",
"ResponseInterface",
"{",
"$",
"note",
"=",
"$",
"request",
"->",
"get",
"(",
"'note'",
",",
"''",
")",
";",
"$",
"privacy_rest... | Process a form to create a new note object.
@param ServerRequestInterface $request
@param Tree $tree
@return ResponseInterface | [
"Process",
"a",
"form",
"to",
"create",
"a",
"new",
"note",
"object",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/EditNoteController.php#L111-L147 | train |
fisharebest/webtrees | app/Module/ClippingsCartModule.php | ClippingsCartModule.allRecordsInCart | 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 {
return GedcomR... | php | 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 {
return GedcomR... | [
"private",
"function",
"allRecordsInCart",
"(",
"Tree",
"$",
"tree",
")",
":",
"array",
"{",
"$",
"cart",
"=",
"Session",
"::",
"get",
"(",
"'cart'",
",",
"[",
"]",
")",
";",
"$",
"xrefs",
"=",
"array_keys",
"(",
"$",
"cart",
"[",
"$",
"tree",
"->"... | Get all the records in the cart.
@param Tree $tree
@return GedcomRecord[] | [
"Get",
"all",
"the",
"records",
"in",
"the",
"cart",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/ClippingsCartModule.php#L908-L928 | train |
fisharebest/webtrees | app/Module/ClippingsCartModule.php | ClippingsCartModule.addRecordToCart | private function addRecordToCart(GedcomRecord $record): void
{
$cart = Session::get('cart', []);
$tree_name = $record->tree()->name();
// Add this record
$cart[$tree_name][$record->xref()] = true;
// Add directly linked media, notes, repositories and sources.
preg_... | php | private function addRecordToCart(GedcomRecord $record): void
{
$cart = Session::get('cart', []);
$tree_name = $record->tree()->name();
// Add this record
$cart[$tree_name][$record->xref()] = true;
// Add directly linked media, notes, repositories and sources.
preg_... | [
"private",
"function",
"addRecordToCart",
"(",
"GedcomRecord",
"$",
"record",
")",
":",
"void",
"{",
"$",
"cart",
"=",
"Session",
"::",
"get",
"(",
"'cart'",
",",
"[",
"]",
")",
";",
"$",
"tree_name",
"=",
"$",
"record",
"->",
"tree",
"(",
")",
"->",... | Add a record (and direclty linked sources, notes, etc. to the cart.
@param GedcomRecord $record
@return void | [
"Add",
"a",
"record",
"(",
"and",
"direclty",
"linked",
"sources",
"notes",
"etc",
".",
"to",
"the",
"cart",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/ClippingsCartModule.php#L937-L954 | train |
fisharebest/webtrees | app/Module/RelationshipsChartModule.php | RelationshipsChartModule.allAncestors | 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 | 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... | [
"private",
"function",
"allAncestors",
"(",
"$",
"xref1",
",",
"$",
"xref2",
",",
"$",
"tree_id",
")",
":",
"array",
"{",
"$",
"ancestors",
"=",
"[",
"$",
"xref1",
",",
"$",
"xref2",
",",
"]",
";",
"$",
"queue",
"=",
"[",
"$",
"xref1",
",",
"$",
... | Find all ancestors of a list of individuals
@param string $xref1
@param string $xref2
@param int $tree_id
@return string[] | [
"Find",
"all",
"ancestors",
"of",
"a",
"list",
"of",
"individuals"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/RelationshipsChartModule.php#L478-L512 | train |
fisharebest/webtrees | app/Module/RelationshipsChartModule.php | RelationshipsChartModule.excludeFamilies | 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 | 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')
... | [
"private",
"function",
"excludeFamilies",
"(",
"$",
"xref1",
",",
"$",
"xref2",
",",
"$",
"tree_id",
")",
":",
"array",
"{",
"return",
"DB",
"::",
"table",
"(",
"'link AS l1'",
")",
"->",
"join",
"(",
"'link AS l2'",
",",
"static",
"function",
"(",
"Join... | Find all families of two individuals
@param string $xref1
@param string $xref2
@param int $tree_id
@return string[] | [
"Find",
"all",
"families",
"of",
"two",
"individuals"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/RelationshipsChartModule.php#L523-L538 | train |
fisharebest/webtrees | app/Services/UpgradeService.php | UpgradeService.extractWebtreesZip | 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)) {
$zip->extractTo($target_folder);
$zip->clo... | php | 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)) {
$zip->extractTo($target_folder);
$zip->clo... | [
"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",
"(",
")"... | Unpack webtrees.zip.
@param string $zip_file
@param string $target_folder
@return void | [
"Unpack",
"webtrees",
".",
"zip",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/UpgradeService.php#L82-L93 | train |
fisharebest/webtrees | app/Services/UpgradeService.php | UpgradeService.webtreesZipContents | 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 | 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))... | [
"public",
"function",
"webtreesZipContents",
"(",
"string",
"$",
"zip_file",
")",
":",
"Collection",
"{",
"$",
"zip_adapter",
"=",
"new",
"ZipArchiveAdapter",
"(",
"$",
"zip_file",
",",
"null",
",",
"'webtrees'",
")",
";",
"$",
"zip_filesystem",
"=",
"new",
... | Create a list of all the files in a webtrees .ZIP archive
@param string $zip_file
@return Collection | [
"Create",
"a",
"list",
"of",
"all",
"the",
"files",
"in",
"a",
"webtrees",
".",
"ZIP",
"archive"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/UpgradeService.php#L102-L114 | train |
fisharebest/webtrees | app/Module/HourglassChartModule.php | HourglassChartModule.chart | 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,
'... | php | 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,
'... | [
"protected",
"function",
"chart",
"(",
"Individual",
"$",
"individual",
",",
"int",
"$",
"generations",
",",
"bool",
"$",
"show_spouse",
")",
":",
"ResponseInterface",
"{",
"$",
"this",
"->",
"layout",
"=",
"'layouts/ajax'",
";",
"return",
"$",
"this",
"->",... | Generate the initial generations of the chart
@param Individual $individual
@param int $generations
@param bool $show_spouse
@return ResponseInterface | [
"Generate",
"the",
"initial",
"generations",
"of",
"the",
"chart"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Module/HourglassChartModule.php#L149-L158 | train |
fisharebest/webtrees | app/Report/ReportHtml.php | ReportHtml.setup | 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 | 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... | [
"public",
"function",
"setup",
"(",
")",
":",
"void",
"{",
"parent",
"::",
"setup",
"(",
")",
";",
"// Setting up the correct dimensions if Portrait (default) or Landscape",
"if",
"(",
"$",
"this",
"->",
"orientation",
"===",
"'landscape'",
")",
"{",
"$",
"tmpw",
... | HTML Setup - ReportHtml
@return void | [
"HTML",
"Setup",
"-",
"ReportHtml"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportHtml.php#L142-L169 | train |
fisharebest/webtrees | app/Report/ReportHtml.php | ReportHtml.runPageHeader | private function runPageHeader()
{
foreach ($this->pageHeaderElements as $element) {
if ($element instanceof ReportBaseElement) {
$element->render($this);
} elseif ($element === 'footnotetexts') {
$this->footnotes();
} elseif ($element === ... | php | private function runPageHeader()
{
foreach ($this->pageHeaderElements as $element) {
if ($element instanceof ReportBaseElement) {
$element->render($this);
} elseif ($element === 'footnotetexts') {
$this->footnotes();
} elseif ($element === ... | [
"private",
"function",
"runPageHeader",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"pageHeaderElements",
"as",
"$",
"element",
")",
"{",
"if",
"(",
"$",
"element",
"instanceof",
"ReportBaseElement",
")",
"{",
"$",
"element",
"->",
"render",
"(",
"$"... | Generate the page header
@return void | [
"Generate",
"the",
"page",
"header"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportHtml.php#L194-L205 | train |
fisharebest/webtrees | app/Report/ReportHtml.php | ReportHtml.createCell | 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, $stretch, $bocolor, $tcolor, $reseth);
} | php | 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, $stretch, $bocolor, $tcolor, $reseth);
} | [
"public",
"function",
"createCell",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"border",
",",
"$",
"align",
",",
"$",
"bgcolor",
",",
"$",
"style",
",",
"$",
"ln",
",",
"$",
"top",
",",
"$",
"left",
",",
"$",
"fill",
",",
"$",
"stretch",
... | Create a new Cell object.
@param int $width cell width (expressed in points)
@param int $height cell height (expressed in points)
@param mixed $border Border style
@param string $align Text alignement
@param string $bgcolor Background color code
@param string $style The name of the text style
@param int... | [
"Create",
"a",
"new",
"Cell",
"object",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportHtml.php#L326-L329 | train |
fisharebest/webtrees | app/Report/ReportHtml.php | ReportHtml.createTextBox | 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
): ReportBaseText... | php | 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
): ReportBaseText... | [
"public",
"function",
"createTextBox",
"(",
"float",
"$",
"width",
",",
"float",
"$",
"height",
",",
"bool",
"$",
"border",
",",
"string",
"$",
"bgcolor",
",",
"bool",
"$",
"newline",
",",
"float",
"$",
"left",
",",
"float",
"$",
"top",
",",
"bool",
... | Create a new TextBox object.
@param float $width Text box width
@param float $height Text box height
@param bool $border
@param string $bgcolor Background color code in HTML
@param bool $newline
@param float $left
@param float $top
@param bool $pagecheck
@param string $style
@param bool $fill
@param boo... | [
"Create",
"a",
"new",
"TextBox",
"object",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportHtml.php#L349-L364 | train |
fisharebest/webtrees | app/Report/ReportHtml.php | ReportHtml.addPage | 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
$this->maxY = $this->Y;
} else {
... | php | 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
$this->maxY = $this->Y;
} else {
... | [
"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... | Update the Page Number and set a new Y if max Y is larger - ReportHtml
@return void | [
"Update",
"the",
"Page",
"Number",
"and",
"set",
"a",
"new",
"Y",
"if",
"max",
"Y",
"is",
"larger",
"-",
"ReportHtml"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportHtml.php#L480-L495 | train |
fisharebest/webtrees | app/Report/ReportHtml.php | ReportHtml.checkFootnote | public function checkFootnote(ReportHtmlFootnote $footnote)
{
$ct = count($this->printedfootnotes);
$i = 0;
$val = $footnote->getValue();
while ($i < $ct) {
if ($this->printedfootnotes[$i]->getValue() == $val) {
// If this footnote already exist then se... | php | public function checkFootnote(ReportHtmlFootnote $footnote)
{
$ct = count($this->printedfootnotes);
$i = 0;
$val = $footnote->getValue();
while ($i < $ct) {
if ($this->printedfootnotes[$i]->getValue() == $val) {
// If this footnote already exist then se... | [
"public",
"function",
"checkFootnote",
"(",
"ReportHtmlFootnote",
"$",
"footnote",
")",
"{",
"$",
"ct",
"=",
"count",
"(",
"$",
"this",
"->",
"printedfootnotes",
")",
";",
"$",
"i",
"=",
"0",
";",
"$",
"val",
"=",
"$",
"footnote",
"->",
"getValue",
"("... | Checks the Footnote and numbers them - ReportHtml
@param ReportHtmlFootnote $footnote
@return ReportHtmlFootnote|bool object if already numbered, false otherwise | [
"Checks",
"the",
"Footnote",
"and",
"numbers",
"them",
"-",
"ReportHtml"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportHtml.php#L530-L551 | train |
fisharebest/webtrees | app/Report/ReportHtml.php | ReportHtml.getCurrentStyleHeight | public function getCurrentStyleHeight(): float
{
if (empty($this->currentStyle)) {
return $this->default_font_size;
}
$style = $this->getStyle($this->currentStyle);
return $style['size'];
} | php | public function getCurrentStyleHeight(): float
{
if (empty($this->currentStyle)) {
return $this->default_font_size;
}
$style = $this->getStyle($this->currentStyle);
return $style['size'];
} | [
"public",
"function",
"getCurrentStyleHeight",
"(",
")",
":",
"float",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"currentStyle",
")",
")",
"{",
"return",
"$",
"this",
"->",
"default_font_size",
";",
"}",
"$",
"style",
"=",
"$",
"this",
"->",
"ge... | Get the current style height.
@return float | [
"Get",
"the",
"current",
"style",
"height",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportHtml.php#L594-L602 | train |
fisharebest/webtrees | app/Report/ReportHtml.php | ReportHtml.getFootnotesHeight | public function getFootnotesHeight(float $cellWidth): float
{
$h = 0;
foreach ($this->printedfootnotes as $element) {
$h += $element->getFootnoteHeight($this, $cellWidth);
}
return $h;
} | php | public function getFootnotesHeight(float $cellWidth): float
{
$h = 0;
foreach ($this->printedfootnotes as $element) {
$h += $element->getFootnoteHeight($this, $cellWidth);
}
return $h;
} | [
"public",
"function",
"getFootnotesHeight",
"(",
"float",
"$",
"cellWidth",
")",
":",
"float",
"{",
"$",
"h",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"printedfootnotes",
"as",
"$",
"element",
")",
"{",
"$",
"h",
"+=",
"$",
"element",
"->",
... | Get the current footnotes height.
@param float $cellWidth
@return float | [
"Get",
"the",
"current",
"footnotes",
"height",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportHtml.php#L611-L619 | train |
fisharebest/webtrees | app/Report/ReportHtml.php | ReportHtml.getStringWidth | public function getStringWidth(string $text): float
{
$style = $this->getStyle($this->currentStyle);
return mb_strlen($text) * ($style['size'] / 2);
} | php | public function getStringWidth(string $text): float
{
$style = $this->getStyle($this->currentStyle);
return mb_strlen($text) * ($style['size'] / 2);
} | [
"public",
"function",
"getStringWidth",
"(",
"string",
"$",
"text",
")",
":",
"float",
"{",
"$",
"style",
"=",
"$",
"this",
"->",
"getStyle",
"(",
"$",
"this",
"->",
"currentStyle",
")",
";",
"return",
"mb_strlen",
"(",
"$",
"text",
")",
"*",
"(",
"$... | Get the width of a string.
@param string $text
@return float | [
"Get",
"the",
"width",
"of",
"a",
"string",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportHtml.php#L648-L653 | train |
fisharebest/webtrees | app/Report/ReportHtml.php | ReportHtml.getTextCellHeight | public function getTextCellHeight(string $str): float
{
// Count the number of lines to calculate the height
$nl = $this->countLines($str);
// Calculate the cell height
return ceil(($this->getCurrentStyleHeight() * $this->cellHeightRatio) * $nl);
} | php | public function getTextCellHeight(string $str): float
{
// Count the number of lines to calculate the height
$nl = $this->countLines($str);
// Calculate the cell height
return ceil(($this->getCurrentStyleHeight() * $this->cellHeightRatio) * $nl);
} | [
"public",
"function",
"getTextCellHeight",
"(",
"string",
"$",
"str",
")",
":",
"float",
"{",
"// Count the number of lines to calculate the height",
"$",
"nl",
"=",
"$",
"this",
"->",
"countLines",
"(",
"$",
"str",
")",
";",
"// Calculate the cell height",
"return"... | Get a text height in points - ReportHtml
@param string $str
@return float | [
"Get",
"a",
"text",
"height",
"in",
"points",
"-",
"ReportHtml"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportHtml.php#L662-L669 | train |
fisharebest/webtrees | app/Report/ReportHtml.php | ReportHtml.setY | public function setY($y)
{
$this->Y = $y;
if ($this->maxY < $y) {
$this->maxY = $y;
}
} | php | public function setY($y)
{
$this->Y = $y;
if ($this->maxY < $y) {
$this->maxY = $y;
}
} | [
"public",
"function",
"setY",
"(",
"$",
"y",
")",
"{",
"$",
"this",
"->",
"Y",
"=",
"$",
"y",
";",
"if",
"(",
"$",
"this",
"->",
"maxY",
"<",
"$",
"y",
")",
"{",
"$",
"this",
"->",
"maxY",
"=",
"$",
"y",
";",
"}",
"}"
] | Set the Y position - ReportHtml
Also updates Max Y position
@param float $y
@return void | [
"Set",
"the",
"Y",
"position",
"-",
"ReportHtml"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportHtml.php#L734-L740 | train |
fisharebest/webtrees | app/Report/ReportHtml.php | ReportHtml.textWrap | public function textWrap(string $str, float $width): string
{
// Calculate the line width
$lw = (int) ($width / ($this->getCurrentStyleHeight() / 2));
// Wordwrap each line
$lines = explode("\n", $str);
// Line Feed counter
$lfct = count($lines);
$wraptext... | php | public function textWrap(string $str, float $width): string
{
// Calculate the line width
$lw = (int) ($width / ($this->getCurrentStyleHeight() / 2));
// Wordwrap each line
$lines = explode("\n", $str);
// Line Feed counter
$lfct = count($lines);
$wraptext... | [
"public",
"function",
"textWrap",
"(",
"string",
"$",
"str",
",",
"float",
"$",
"width",
")",
":",
"string",
"{",
"// Calculate the line width",
"$",
"lw",
"=",
"(",
"int",
")",
"(",
"$",
"width",
"/",
"(",
"$",
"this",
"->",
"getCurrentStyleHeight",
"("... | Wrap text - ReportHtml
@param string $str Text to wrap
@param float $width Width in points the text has to fit into
@return string | [
"Wrap",
"text",
"-",
"ReportHtml"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportHtml.php#L766-L786 | train |
fisharebest/webtrees | app/Report/ReportHtml.php | ReportHtml.write | 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)) {
... | php | 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)) {
... | [
"public",
"function",
"write",
"(",
"$",
"text",
",",
"$",
"color",
"=",
"''",
",",
"$",
"useclass",
"=",
"true",
")",
"{",
"$",
"style",
"=",
"$",
"this",
"->",
"getStyle",
"(",
"$",
"this",
"->",
"getCurrentStyle",
"(",
")",
")",
";",
"$",
"htm... | Write text - ReportHtml
@param string $text Text to print
@param string $color HTML RGB color code (Ex: #001122)
@param bool $useclass
@return void | [
"Write",
"text",
"-",
"ReportHtml"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Report/ReportHtml.php#L797-L822 | train |
fisharebest/webtrees | app/Http/Controllers/Admin/UpgradeController.php | UpgradeController.step | 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:
... | php | 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:
... | [
"public",
"function",
"step",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"?",
"Tree",
"$",
"tree",
")",
":",
"ResponseInterface",
"{",
"$",
"step",
"=",
"$",
"request",
"->",
"getQueryParams",
"(",
")",
"[",
"'step'",
"]",
"??",
"self",
"::",
"S... | Perform one step of the wizard
@param ServerRequestInterface $request
@param Tree|null $tree
@return ResponseInterface | [
"Perform",
"one",
"step",
"of",
"the",
"wizard"
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/Admin/UpgradeController.php#L160-L195 | train |
fisharebest/webtrees | app/Http/Controllers/Admin/UpgradeController.php | UpgradeController.wizardStepPrepare | 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(se... | php | 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(se... | [
"private",
"function",
"wizardStepPrepare",
"(",
")",
":",
"ResponseInterface",
"{",
"$",
"this",
"->",
"filesystem",
"->",
"deleteDir",
"(",
"self",
"::",
"UPGRADE_FOLDER",
")",
";",
"$",
"this",
"->",
"filesystem",
"->",
"createDir",
"(",
"self",
"::",
"UP... | Make sure the temporary folder exists.
@return ResponseInterface | [
"Make",
"sure",
"the",
"temporary",
"folder",
"exists",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Http/Controllers/Admin/UpgradeController.php#L226-L234 | train |
fisharebest/webtrees | app/FlashMessages.php | FlashMessages.addMessage | 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, $message... | php | 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, $message... | [
"public",
"static",
"function",
"addMessage",
"(",
"$",
"text",
",",
"$",
"status",
"=",
"'info'",
")",
":",
"void",
"{",
"$",
"message",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"message",
"->",
"text",
"=",
"$",
"text",
";",
"$",
"message",
"-... | Add a message to the session storage.
@param string $text
@param string $status "success", "info", "warning" or "danger"
@return void | [
"Add",
"a",
"message",
"to",
"the",
"session",
"storage",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/FlashMessages.php#L38-L47 | train |
fisharebest/webtrees | app/FlashMessages.php | FlashMessages.getMessages | public static function getMessages(): array
{
$messages = Session::get(self::FLASH_KEY, []);
Session::forget(self::FLASH_KEY);
return $messages;
} | php | public static function getMessages(): array
{
$messages = Session::get(self::FLASH_KEY, []);
Session::forget(self::FLASH_KEY);
return $messages;
} | [
"public",
"static",
"function",
"getMessages",
"(",
")",
":",
"array",
"{",
"$",
"messages",
"=",
"Session",
"::",
"get",
"(",
"self",
"::",
"FLASH_KEY",
",",
"[",
"]",
")",
";",
"Session",
"::",
"forget",
"(",
"self",
"::",
"FLASH_KEY",
")",
";",
"r... | Get the current messages, and remove them from session storage.
@return stdClass[] | [
"Get",
"the",
"current",
"messages",
"and",
"remove",
"them",
"from",
"session",
"storage",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/FlashMessages.php#L54-L60 | train |
fisharebest/webtrees | app/Services/HousekeepingService.php | HousekeepingService.deleteOldWebtreesFiles | 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;... | php | 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;... | [
"public",
"function",
"deleteOldWebtreesFiles",
"(",
"Filesystem",
"$",
"filesystem",
")",
":",
"array",
"{",
"$",
"paths_to_delete",
"=",
"[",
"]",
";",
"foreach",
"(",
"self",
"::",
"OLD_PATHS",
"as",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"$",
"this",... | Delete files and folders that belonged to an earlier version of webtrees.
Return a list of those that we could not delete.
@param Filesystem $filesystem
@return array | [
"Delete",
"files",
"and",
"folders",
"that",
"belonged",
"to",
"an",
"earlier",
"version",
"of",
"webtrees",
".",
"Return",
"a",
"list",
"of",
"those",
"that",
"we",
"could",
"not",
"delete",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/HousekeepingService.php#L382-L393 | train |
fisharebest/webtrees | app/Services/HousekeepingService.php | HousekeepingService.deleteOldFiles | 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) {
... | php | 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) {
... | [
"public",
"function",
"deleteOldFiles",
"(",
"Filesystem",
"$",
"filesystem",
",",
"string",
"$",
"path",
",",
"int",
"$",
"max_age",
")",
":",
"void",
"{",
"$",
"list",
"=",
"$",
"filesystem",
"->",
"listContents",
"(",
"$",
"path",
",",
"true",
")",
... | Delete old cache files.
@param Filesystem $filesystem
@param string $path
@param int $max_age Seconds
@return void | [
"Delete",
"old",
"cache",
"files",
"."
] | 840bd0d721dc479520ec24a065996bc6becb8348 | https://github.com/fisharebest/webtrees/blob/840bd0d721dc479520ec24a065996bc6becb8348/app/Services/HousekeepingService.php#L404-L415 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.