◆ cleanupPreInstalledPublicDomainFullName()
ilMDCopyrightMigration::cleanupPreInstalledPublicDomainFullName |
( |
string |
$full_name | ) |
|
|
protected |
◆ extractFields()
ilMDCopyrightMigration::extractFields |
( |
string |
$title, |
|
|
string |
$copyright |
|
) |
| |
|
protected |
Definition at line 86 of file class.ilMDCopyrightMigration.php.
References cleanupPreInstalledPublicDomainFullName(), ilDBConstants\T_TEXT, translatePreInstalledLinksToSVG(), and updatePreInstalledTitles().
Referenced by step().
96 if (preg_match(
'/<\s*img((?:.|\n)*?)\/>/i', $copyright, $img_matches)) {
97 if (preg_match(
'/src\s*=\s*(?:"|\')(.*?)(?:"|\')/i', $img_matches[1], $src_matches)) {
98 $image_link = strip_tags($src_matches[1]);
100 if (preg_match(
'/alt\s*=\s*(?:"|\')(.*?)(?:"|\')/i', $img_matches[1], $alt_matches)) {
101 $alt_text = strip_tags($alt_matches[1]);
106 if (preg_match(
'/<\s*a((?:.|\n)[^<]*?)<\s*\/a>/i', $copyright, $link_matches)) {
107 if (preg_match(
'/href\s*=\s*(?:"|\')(.*?)(?:"|\')/i', $link_matches[1], $name_matches)) {
108 $link = strip_tags($name_matches[1]);
110 if (preg_match(
'/>((?:\n|.)*)/i', $link_matches[1], $href_matches)) {
111 $full_name = strip_tags($href_matches[1]);
114 $full_name = strip_tags($copyright);
updatePreInstalledTitles(string $link, string $title)
see https://mantis.ilias.de/view.php?id=41301
cleanupPreInstalledPublicDomainFullName(string $full_name)
see https://mantis.ilias.de/view.php?id=41301
translatePreInstalledLinksToSVG(string $image_link)
◆ getDefaultAmountOfStepsPerRun()
ilMDCopyrightMigration::getDefaultAmountOfStepsPerRun |
( |
| ) |
|
◆ getLabel()
ilMDCopyrightMigration::getLabel |
( |
| ) |
|
◆ getPreconditions()
ilMDCopyrightMigration::getPreconditions |
( |
Environment |
$environment | ) |
|
◆ getRemainingAmountOfSteps()
ilMDCopyrightMigration::getRemainingAmountOfSteps |
( |
| ) |
|
Definition at line 76 of file class.ilMDCopyrightMigration.php.
References $res.
78 $res = $this->db->query(
79 'SELECT COUNT(*) AS count FROM il_md_cpr_selections WHERE migrated = 0' 82 $row = $this->db->fetchAssoc(
$res);
83 return (
int) $row[
'count'];
◆ prepare()
ilMDCopyrightMigration::prepare |
( |
Environment |
$environment | ) |
|
◆ step()
ilMDCopyrightMigration::step |
( |
Environment |
$environment | ) |
|
Definition at line 53 of file class.ilMDCopyrightMigration.php.
References $res, extractFields(), and ilDBConstants\T_INTEGER.
55 $res = $this->db->query(
56 'SELECT entry_id, title, copyright FROM il_md_cpr_selections WHERE migrated = 0 LIMIT 1' 59 if ($row = $this->db->fetchAssoc(
$res)) {
60 if (!isset($row[
'entry_id'])) {
64 (
string) ($row[
'title'] ??
''),
65 (
string) ($row[
'copyright'] ??
'')
69 'il_md_cpr_selections',
extractFields(string $title, string $copyright)
◆ translatePreInstalledLinksToSVG()
ilMDCopyrightMigration::translatePreInstalledLinksToSVG |
( |
string |
$image_link | ) |
|
|
protected |
Definition at line 130 of file class.ilMDCopyrightMigration.php.
Referenced by extractFields().
134 'https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc-nd.svg',
135 'https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc-sa.svg',
136 'https://i.creativecommons.org/l/by-nc/4.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc.svg',
137 'https://i.creativecommons.org/l/by-nd/4.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nd.svg',
138 'https://i.creativecommons.org/l/by-sa/4.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-sa.svg',
139 'https://i.creativecommons.org/l/by/4.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by.svg',
141 'http://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc-nd.svg',
142 'http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc-sa.svg',
143 'http://i.creativecommons.org/l/by-nc/3.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc.svg',
144 'http://i.creativecommons.org/l/by-nd/3.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nd.svg',
145 'http://i.creativecommons.org/l/by-sa/3.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-sa.svg',
146 'http://i.creativecommons.org/l/by/3.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by.svg' 149 if (key_exists($image_link, $mapping)) {
150 return $mapping[$image_link];
◆ updatePreInstalledTitles()
ilMDCopyrightMigration::updatePreInstalledTitles |
( |
string |
$link, |
|
|
string |
$title |
|
) |
| |
|
protected |
see https://mantis.ilias.de/view.php?id=41301
Definition at line 158 of file class.ilMDCopyrightMigration.php.
Referenced by extractFields().
160 $old_titles_by_link = [
161 'http://creativecommons.org/licenses/by-nc-nd/4.0/' =>
'Attribution Non-commercial No Derivatives (by-nc-nd)',
162 'http://creativecommons.org/licenses/by-nc-sa/4.0/' =>
'Attribution Non-commercial Share Alike (by-nc-sa)',
163 'http://creativecommons.org/licenses/by-nc/4.0/' =>
'Attribution Non-commercial (by-nc)',
164 'http://creativecommons.org/licenses/by-nd/4.0/' =>
'Attribution No Derivatives (by-nd)',
165 'http://creativecommons.org/licenses/by-sa/4.0/' =>
'Attribution Share Alike (by-sa)',
166 'http://creativecommons.org/licenses/by/4.0/' =>
'Attribution (by)' 168 $new_titles_by_link = [
169 'http://creativecommons.org/licenses/by-nc-nd/4.0/' =>
'Attribution Non-commercial No Derivatives (BY-NC-ND) 4.0',
170 'http://creativecommons.org/licenses/by-nc-sa/4.0/' =>
'Attribution Non-commercial Share Alike (BY-NC-SA) 4.0',
171 'http://creativecommons.org/licenses/by-nc/4.0/' =>
'Attribution Non-commercial (BY-NC) 4.0',
172 'http://creativecommons.org/licenses/by-nd/4.0/' =>
'Attribution No Derivatives (BY-ND) 4.0',
173 'http://creativecommons.org/licenses/by-sa/4.0/' =>
'Attribution Share Alike (BY-SA) 4.0',
174 'http://creativecommons.org/licenses/by/4.0/' =>
'Attribution (BY) 4.0' 177 key_exists($link, $old_titles_by_link) &&
178 $old_titles_by_link[$link] === $title &&
179 key_exists($link, $new_titles_by_link)
181 return $new_titles_by_link[$link];
◆ $db
The documentation for this class was generated from the following file: