Reindent
This commit is contained in:
parent
1dfdd22f43
commit
50ae991e95
|
@ -118,106 +118,104 @@ class JSONRenderer
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getJson ($complete = false) {
|
public static function getJson ($complete = false) {
|
||||||
global $config;
|
global $config;
|
||||||
$page = getURLParam ("page", Base::PAGE_INDEX);
|
$page = getURLParam ("page", Base::PAGE_INDEX);
|
||||||
$query = getURLParam ("query");
|
$query = getURLParam ("query");
|
||||||
$search = getURLParam ("search");
|
$search = getURLParam ("search");
|
||||||
$qid = getURLParam ("id");
|
$qid = getURLParam ("id");
|
||||||
$n = getURLParam ("n", "1");
|
$n = getURLParam ("n", "1");
|
||||||
$database = GetUrlParam (DB);
|
$database = GetUrlParam (DB);
|
||||||
|
|
||||||
$currentPage = Page::getPage ($page, $qid, $query, $n);
|
$currentPage = Page::getPage ($page, $qid, $query, $n);
|
||||||
$currentPage->InitializeContent ();
|
$currentPage->InitializeContent ();
|
||||||
|
|
||||||
if ($search) {
|
if ($search) {
|
||||||
return self::getContentArrayTypeahead ($currentPage);
|
return self::getContentArrayTypeahead ($currentPage);
|
||||||
}
|
|
||||||
|
|
||||||
$out = array ( "title" => $currentPage->title);
|
|
||||||
$entries = array ();
|
|
||||||
foreach ($currentPage->entryArray as $entry) {
|
|
||||||
array_push ($entries, self::getContentArray ($entry));
|
|
||||||
}
|
|
||||||
if (!is_null ($currentPage->book)) {
|
|
||||||
$out ["book"] = self::getFullBookContentArray ($currentPage->book);
|
|
||||||
}
|
|
||||||
$out ["databaseId"] = GetUrlParam (DB, "");
|
|
||||||
$out ["databaseName"] = Base::getDbName ();
|
|
||||||
$out ["page"] = $page;
|
|
||||||
$out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled () ? 1 : 0;
|
|
||||||
$out ["entries"] = $entries;
|
|
||||||
$out ["isPaginated"] = 0;
|
|
||||||
if ($currentPage->isPaginated ()) {
|
|
||||||
$prevLink = $currentPage->getPrevLink ();
|
|
||||||
$nextLink = $currentPage->getNextLink ();
|
|
||||||
$out ["isPaginated"] = 1;
|
|
||||||
$out ["prevLink"] = "";
|
|
||||||
if (!is_null ($prevLink)) {
|
|
||||||
$out ["prevLink"] = $prevLink->hrefXhtml ();
|
|
||||||
}
|
}
|
||||||
$out ["nextLink"] = "";
|
|
||||||
if (!is_null ($nextLink)) {
|
$out = array ( "title" => $currentPage->title);
|
||||||
$out ["nextLink"] = $nextLink->hrefXhtml ();
|
$entries = array ();
|
||||||
|
foreach ($currentPage->entryArray as $entry) {
|
||||||
|
array_push ($entries, self::getContentArray ($entry));
|
||||||
}
|
}
|
||||||
$out ["maxPage"] = $currentPage->getMaxPage ();
|
if (!is_null ($currentPage->book)) {
|
||||||
$out ["currentPage"] = $currentPage->n;
|
$out ["book"] = self::getFullBookContentArray ($currentPage->book);
|
||||||
}
|
|
||||||
if (!is_null (getURLParam ("complete")) || $complete) {
|
|
||||||
$out ["c"] = array ("version" => VERSION, "i18n" => array (
|
|
||||||
"coverAlt" => localize("i18n.coversection"),
|
|
||||||
"authorsTitle" => localize("authors.title"),
|
|
||||||
"bookwordTitle" => localize("bookword.title"),
|
|
||||||
"tagsTitle" => localize("tags.title"),
|
|
||||||
"seriesTitle" => localize("series.title"),
|
|
||||||
"customizeTitle" => localize ("customize.title"),
|
|
||||||
"aboutTitle" => localize ("about.title"),
|
|
||||||
"previousAlt" => localize ("paging.previous.alternate"),
|
|
||||||
"nextAlt" => localize ("paging.next.alternate"),
|
|
||||||
"searchAlt" => localize ("search.alternate"),
|
|
||||||
"sortAlt" => localize ("sort.alternate"),
|
|
||||||
"homeAlt" => localize ("home.alternate"),
|
|
||||||
"cogAlt" => localize ("cog.alternate"),
|
|
||||||
"permalinkAlt" => localize ("permalink.alternate"),
|
|
||||||
"publisherName" => localize("publisher.name"),
|
|
||||||
"pubdateTitle" => localize("pubdate.title"),
|
|
||||||
"languagesTitle" => localize("language.title"),
|
|
||||||
"contentTitle" => localize("content.summary"),
|
|
||||||
"sortorderAsc" => localize("search.sortorder.asc"),
|
|
||||||
"sortorderDesc" => localize("search.sortorder.desc"),
|
|
||||||
"customizeEmail" => localize("customize.email")),
|
|
||||||
"url" => array (
|
|
||||||
"detailUrl" => "index.php?page=13&id={0}&db={1}",
|
|
||||||
"coverUrl" => "fetch.php?id={0}&db={1}",
|
|
||||||
"thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"),
|
|
||||||
"config" => array (
|
|
||||||
"use_fancyapps" => $config ["cops_use_fancyapps"],
|
|
||||||
"max_item_per_page" => $config['cops_max_item_per_page'],
|
|
||||||
"server_side_rendering" => useServerSideRendering (),
|
|
||||||
"html_tag_filter" => $config['cops_html_tag_filter']));
|
|
||||||
if ($config['cops_thumbnail_handling'] == "1") {
|
|
||||||
$out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"];
|
|
||||||
} else if (!empty ($config['cops_thumbnail_handling'])) {
|
|
||||||
$out ["c"]["url"]["thumbnailUrl"] = $config['cops_thumbnail_handling'];
|
|
||||||
}
|
}
|
||||||
}
|
$out ["databaseId"] = GetUrlParam (DB, "");
|
||||||
|
$out ["databaseName"] = Base::getDbName ();
|
||||||
|
$out ["page"] = $page;
|
||||||
|
$out ["multipleDatabase"] = Base::isMultipleDatabaseEnabled () ? 1 : 0;
|
||||||
|
$out ["entries"] = $entries;
|
||||||
|
$out ["isPaginated"] = 0;
|
||||||
|
if ($currentPage->isPaginated ()) {
|
||||||
|
$prevLink = $currentPage->getPrevLink ();
|
||||||
|
$nextLink = $currentPage->getNextLink ();
|
||||||
|
$out ["isPaginated"] = 1;
|
||||||
|
$out ["prevLink"] = "";
|
||||||
|
if (!is_null ($prevLink)) {
|
||||||
|
$out ["prevLink"] = $prevLink->hrefXhtml ();
|
||||||
|
}
|
||||||
|
$out ["nextLink"] = "";
|
||||||
|
if (!is_null ($nextLink)) {
|
||||||
|
$out ["nextLink"] = $nextLink->hrefXhtml ();
|
||||||
|
}
|
||||||
|
$out ["maxPage"] = $currentPage->getMaxPage ();
|
||||||
|
$out ["currentPage"] = $currentPage->n;
|
||||||
|
}
|
||||||
|
if (!is_null (getURLParam ("complete")) || $complete) {
|
||||||
|
$out ["c"] = array ("version" => VERSION, "i18n" => array (
|
||||||
|
"coverAlt" => localize("i18n.coversection"),
|
||||||
|
"authorsTitle" => localize("authors.title"),
|
||||||
|
"bookwordTitle" => localize("bookword.title"),
|
||||||
|
"tagsTitle" => localize("tags.title"),
|
||||||
|
"seriesTitle" => localize("series.title"),
|
||||||
|
"customizeTitle" => localize ("customize.title"),
|
||||||
|
"aboutTitle" => localize ("about.title"),
|
||||||
|
"previousAlt" => localize ("paging.previous.alternate"),
|
||||||
|
"nextAlt" => localize ("paging.next.alternate"),
|
||||||
|
"searchAlt" => localize ("search.alternate"),
|
||||||
|
"sortAlt" => localize ("sort.alternate"),
|
||||||
|
"homeAlt" => localize ("home.alternate"),
|
||||||
|
"cogAlt" => localize ("cog.alternate"),
|
||||||
|
"permalinkAlt" => localize ("permalink.alternate"),
|
||||||
|
"publisherName" => localize("publisher.name"),
|
||||||
|
"pubdateTitle" => localize("pubdate.title"),
|
||||||
|
"languagesTitle" => localize("language.title"),
|
||||||
|
"contentTitle" => localize("content.summary"),
|
||||||
|
"sortorderAsc" => localize("search.sortorder.asc"),
|
||||||
|
"sortorderDesc" => localize("search.sortorder.desc"),
|
||||||
|
"customizeEmail" => localize("customize.email")),
|
||||||
|
"url" => array (
|
||||||
|
"detailUrl" => "index.php?page=13&id={0}&db={1}",
|
||||||
|
"coverUrl" => "fetch.php?id={0}&db={1}",
|
||||||
|
"thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"),
|
||||||
|
"config" => array (
|
||||||
|
"use_fancyapps" => $config ["cops_use_fancyapps"],
|
||||||
|
"max_item_per_page" => $config['cops_max_item_per_page'],
|
||||||
|
"server_side_rendering" => useServerSideRendering (),
|
||||||
|
"html_tag_filter" => $config['cops_html_tag_filter']));
|
||||||
|
if ($config['cops_thumbnail_handling'] == "1") {
|
||||||
|
$out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"];
|
||||||
|
} else if (!empty ($config['cops_thumbnail_handling'])) {
|
||||||
|
$out ["c"]["url"]["thumbnailUrl"] = $config['cops_thumbnail_handling'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$out ["containsBook"] = 0;
|
$out ["containsBook"] = 0;
|
||||||
if ($currentPage->containsBook ()) {
|
if ($currentPage->containsBook ()) {
|
||||||
$out ["containsBook"] = 1;
|
$out ["containsBook"] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$out["abouturl"] = "index.php" . addURLParameter ("?page=16", DB, $database);
|
||||||
|
|
||||||
|
if ($page == Base::PAGE_ABOUT) {
|
||||||
|
$temp = preg_replace ("/\<h1\>About COPS\<\/h1\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html'));
|
||||||
|
$out ["fullhtml"] = $temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
$out ["homeurl"] = "index.php";
|
||||||
|
if ($page != Base::PAGE_INDEX && !is_null ($database)) $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter ("", DB, $database);
|
||||||
|
|
||||||
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out["abouturl"] = "index.php" . addURLParameter ("?page=16", DB, $database);
|
|
||||||
|
|
||||||
if ($page == Base::PAGE_ABOUT) {
|
|
||||||
$temp = preg_replace ("/\<h1\>About COPS\<\/h1\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html'));
|
|
||||||
$out ["fullhtml"] = $temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
$out ["homeurl"] = "index.php";
|
|
||||||
if ($page != Base::PAGE_INDEX && !is_null ($database)) $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter ("", DB, $database);
|
|
||||||
|
|
||||||
return $out;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue