-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Story.php
82 lines (64 loc) · 2.42 KB
/
Story.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
# Story
$language = $Language -> user_language;
$full_language = $Language -> full_user_language;
if ($language == "general") {
$language = "en";
$full_language = "English";
}
# Create the basic story website tabs
$tab_titles = [
"read_story",
"readers",
"other_stories"
];
$tabs = [];
foreach ($tab_titles as $tab) {
$tabs[$tab] = [
"template" => $tab
];
}
$website["tabs"]["data"] = $website["tabs"]["data"] + $tabs;
# Move the websites tab template to the end
$backup = $website["tabs"]["data"]["websites_tab"];
unset($website["tabs"]["data"]["websites_tab"]);
$website["tabs"]["data"]["websites_tab"] = $backup;
# Require all of the PHP files inside the "Story" folder
$array = $folders["PHP"]["Story folder"];
$keys = array_keys($array);
$keys = array_diff($keys, ["root"]);
foreach ($keys as $key) {
$file = $array[$key];
require $file;
}
# "Chapter tabs.php", to generate the chapter tabs
# "Insert variables.php", to create the "Variable Inserter" array
# "Modals.php", to generate the modals for the chapter comments and reads
# "Story cards.php", to generate the story cards used in the "Stories" tab
# Define the tab templates for story websites
$website["tabs"]["templates"] = [
"read_story" => [
"name" => $website["Language texts"]["read_story"],
"title" => $website["Language texts"]["chapters_in_[language]"].": ".$website["Language texts"]["language_icon"]." ".HTML::Element("span", $story["Information"]["Chapters"]["Numbers"]["Total"], "", $website["Style"]["text"]["theme"]["dark"]),
"content" => $story["chapter_buttons"],
"icon" => "open_book"
],
"readers" => [
"name" => $website["Language texts"]["readers, title()"],
"add" => " ".HTML::Element("span", $story["Information"]["Readers"]["Number"], "", $website["Style"]["text"]["theme"]["dark"]),
"content" => Text::From_Array($story["Information"]["Readers"]["List"], "", $enumerate = True, $website["Style"]["text_highlight"], "text_hover_white"),
"icon" => "reader"
],
"other_stories" => [
"name" => $website["Language texts"]["other_stories"],
"add" => " ".HTML::Element("span", ($stories["Numbers"]["Total"]), "", $website["Style"]["text"]["theme"]["dark"]),
"content" => $website["story_cards"],
"icon" => "book"
]
];
# If the number of readers is zero, remove the "Readers" tab
if ($story["Information"]["Readers"]["Number"] == 0) {
unset($website["tabs"]["data"]["readers"]);
unset($website["tabs"]["templates"]["readers"]);
}
?>