Skip to content

Commit

Permalink
Merge pull request #114 from internetarchive/schema-rewrtie
Browse files Browse the repository at this point in the history
Support segregated schemas
  • Loading branch information
cyberpower678 committed Jan 9, 2024
2 parents 1212c22 + 13d6aca commit e41dfb5
Show file tree
Hide file tree
Showing 46 changed files with 2,129 additions and 2,443 deletions.
1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

185 changes: 93 additions & 92 deletions app/src/Core/APII.php

Large diffs are not rendered by default.

21 changes: 12 additions & 9 deletions app/src/Core/CiteMap.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
Copyright (c) 2015-2023, Maximilian Doerr, Internet Archive
Copyright (c) 2015-2024, Maximilian Doerr, Internet Archive
This file is part of IABot's Framework.
Expand All @@ -22,7 +22,7 @@
* CiteMap object
* @author Maximilian Doerr (Cyberpower678)
* @license https://www.gnu.org/licenses/agpl-3.0.txt
* @copyright Copyright (c) 2015-2023, Maximilian Doerr, Internet Archive
* @copyright Copyright (c) 2015-2024, Maximilian Doerr, Internet Archive
*/

/**
Expand All @@ -32,7 +32,7 @@
* @abstract
* @author Maximilian Doerr (Cyberpower678)
* @license https://www.gnu.org/licenses/agpl-3.0.txt
* @copyright Copyright (c) 2015-2023, Maximilian Doerr, Internet Archive
* @copyright Copyright (c) 2015-2024, Maximilian Doerr, Internet Archive
*/
class CiteMap {

Expand Down Expand Up @@ -228,9 +228,9 @@ class CiteMap {

protected $informalName = false;

protected $map = false;
protected $map = [];

protected $templateData = false;
protected $templateData = [];

protected $string = false;

Expand Down Expand Up @@ -301,11 +301,11 @@ public function loadMapString( $string ) {
}

public function clearMap( $eraseAll = false ) {
$this->map = false;
$this->map = [];
$this->redirected = false;
$this->disabled = false;
$this->disabledByUser = false;
$this->templateData = false;
$this->templateData = [];
if( $eraseAll ) {
$this->luaLocation = false;
$this->string = false;
Expand Down Expand Up @@ -402,14 +402,17 @@ public function loadTemplateData( $params, $citoid ) {
break;
case "accessDate":
$mapType = "access_date";
if( !$customValues ) $customValues = [];
$customValues['format'] = 'automatic';
break;
case "archiveLocation":
$mapType = "archive_url";
if( !$customValues ) $customValues = [];
$customValues = false;
break;
case "archiveDate":
$mapType = "archive_date";
if( !$customValues ) $customValues = [];
$customValues['format'] = 'automatic';
break;
case "title":
Expand Down Expand Up @@ -822,7 +825,7 @@ protected function applyFromGlobal() {
$params[] = $map['params'][$paramID];
}

if( $this->templateData ) {
if( !empty( $this->templateData ) ) {
foreach( $params as $param ) {
if( isset( $this->templateData['params'][$param] ) ) {
if( isset( $this->templateData['params'][$param]['aliases'] ) ) {
Expand Down Expand Up @@ -2373,7 +2376,7 @@ public function renderMap() {
}

public function isDisabled() {
if( $this->map === false ) return true;
if( empty( $this->map ) ) return true;
if( empty( $this->map['services'] ) ) return true;

return $this->disabled;
Expand Down
Loading

0 comments on commit e41dfb5

Please sign in to comment.