-
Notifications
You must be signed in to change notification settings - Fork 0
/
meatofit.php
226 lines (178 loc) · 7.29 KB
/
meatofit.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<?php
// For the sake of logical-instantanaety, Storikaze only retrieves
// the date once per run.
$storikaze_time_now = current_time('mysql');
//$storikaze_foolproof_id = "x";
// Just to get shortcodes to work in the widgets:
add_filter('widget_text', 'do_shortcode');
// WordPress was originally written for blogs - and therefore
// sorts the entries so that the most recent one appears first.
// However, that is not what we want in webfiction - so this
// code will change the order so that the oldest post appears
// first.
if ( ! function_exists( 'storikaze_fix_sort_order_in_qry' ) ) :
function storikaze_fix_sort_order_in_qry ( $query )
{
// We do not want the order reversed on the admin panels -
// only the actual public web-site.
if ( is_admin() ) { return; }
// We also do not want it reversing the order on the feeds.
if ( is_feed() ) { return; }
// Also -- when viewing individual post-pages, we do not
// want the "next" and "previous" buttons mixed up.
if ( is_single() )
{
if ( ! is_archive() ) { return; }
}
$query->set('order','ASC');
}
endif; // twentyfifteen_setup
add_action( 'pre_get_posts', 'storikaze_fix_sort_order_in_qry' );
// Just as with webcomics, the author of a webserial wants to
// be able to schedule in-advance when a subchapter is added
// to the book. This means two things (1) scheduling when the
// post itself appears in the post-sequence and (2) scheduling
// the Table of Contents to reflect the change as well. For
// actual posts themselves (issue #1) WordPress has it's own
// built-in scheduling feature. But for issue #2, you will need
// a shortcode to enclose sections of text who's visibility is
// scheculed. Introducing the [storikaze_at] shortcode.
if ( ! function_exists( 'storikaze_tag_at' ) ) :
function storikaze_tag_at ( $atts, $content = null ) {
$timecode = strtotime($GLOBALS["storikaze_time_now"]);
// Of course, if the page is being displayed in preview mode,
// we want anything to show up. (This part of code may change
// if there is a way to have a preview with a particular
// point in time specified.)
if ( is_preview() ) { return do_shortcode($content); }
foreach ( $atts as $thenom => $theval )
{
if ( $thenom == "from" )
{
if ( $timecode < strtotime($theval) ) { return ""; }
}
// The "to" attribute specifies a time at which the text
// disappears (such as the "story still in progress" note
// at the end of the TOC -- but only once you know at what
// time the very last installation of the story will be
// added).
if ( $thenom == "to" )
{
if ( $timecode > strtotime($theval) ) { return ""; }
}
}
return do_shortcode($content);
}
endif;
add_shortcode( 'storikaze_at', 'storikaze_tag_at' );
// Even though it is primarily for debugging purposes, I need to
// be able to know what time Storikaze has it as.
if ( ! function_exists( 'storikaze_tag_now' ) ) :
function storikaze_tag_now ( $atts )
{
return $GLOBALS["storikaze_time_now"];
}
endif;
add_shortcode( 'storikaze_now', 'storikaze_tag_now' );
// Now we will create the function to set up the story-element-appearnce
// array --- and use it.
// The first argument of the function is the array of the story text
// gimmick.
// The second argument of the function is the priority area-level and the third
// is an array that is to be the contents of the story-elemant-appearance
// variable.
//
// Eventually, once this feature is improved, it will be possible for
// Storikaze-aware themes to override the defaults set by this function
// --- but we ask to please wait at *least* until the *interface* details
// of this function are finalized.
if ( ! function_exists( 'storikaze_tex_gim_set' ) ) :
function storikaze_tex_gim_set ( $trgnom, $priorty, $valua )
{
// Do NOT register anything that isn't an array.
if ( ! is_array($valua) ) { return; }
// If the target array doesn't exist as an array, create it now.
if ( ! is_array($GLOBALS["storikaze_tex_gim_r"]) )
{
$GLOBALS["storikaze_tex_gim_r"] = array();
}
// If the gimmick does not currently exist, let us set it
// and be done with this function.
if ( ! is_array($GLOBALS["storikaze_tex_gim_r"][$trgnom]) )
{
$GLOBALS["storikaze_tex_gim_r"][$trgnom] = array($priorty,$valua);
return;
}
// Now, if something already is there, we change it only if the
// current priority level is higher (i.e. a smaller number) than
// the old one.
$curray = $GLOBALS["storikaze_tex_gim_r"][$trgnom];
if ( $curray[0] > $priorty )
{
$GLOBALS["storikaze_tex_gim_r"][$trgnom] = array($priorty,$valua);
return;
}
}
endif;
// The tag [storikaze_segbreak /] should be used in places within
// a chapter where there is a narrative shift such as a scene change.
if ( ! function_exists( 'storikaze_tag_segbreak' ) ) :
function storikaze_tag_segbreak ( $atts )
{
if ( !is_array($GLOBALS["storikaze_tex_gim_r"]) ) { return ""; }
if ( !is_array($GLOBALS["storikaze_tex_gim_r"]["segbreak"]) ) { return ""; }
$refera = $GLOBALS["storikaze_tex_gim_r"]["segbreak"];
if ( !is_array($refera[1]) ) { return ""; }
$referb = $refera[1];
return ( $referb["slval"] );
}
endif;
add_shortcode( 'storikaze_segbreak', 'storikaze_tag_segbreak' );
storikaze_tex_gim_set("segbreak",'default',array(
"slval" => "\n\n<div align = \"center\"><p>* * *</p></div>\n\n"
));
// The tag [storikaze_chbreak /] should be used at the end of
// the final post of every chapter.
if ( ! function_exists( 'storikaze_tag_chbreak' ) ) :
function storikaze_tag_chbreak ( $atts )
{
if ( !is_array($GLOBALS["storikaze_tex_gim_r"]) ) { return ""; }
if ( !is_array($GLOBALS["storikaze_tex_gim_r"]["chbreak"]) ) { return ""; }
$refera = $GLOBALS["storikaze_tex_gim_r"]["chbreak"];
if ( !is_array($refera[1]) ) { return ""; }
$referb = $refera[1];
return ( $referb["slval"] );
}
endif;
add_shortcode( 'storikaze_chbreak', 'storikaze_tag_chbreak' );
storikaze_tex_gim_set("chbreak",'default',array(
"slval" => "\n\n\n\n"
));
// The [storikaze_info] shortcode exists to store information
// related to the structural organization of the fiction. It isn't
// used much by the current version of the plug-in - but it could
// very well be used by future versions, as well as by accessory
// programs - so it is important that it be used correctly with
// the correct attributes.
if ( ! function_exists( 'storikaze_tag_info' ) ) :
function storikaze_tag_info ( $atts, $content = null ) {
return "";
}
endif;
add_shortcode( 'storikaze_info', 'storikaze_tag_info' );
require_once(dirname(__FILE__) . "/utlf/f_storikaze_lcvar_file.php");
require_once(dirname(__FILE__) . "/csfun/main.php");
require_once(dirname(__FILE__) . "/adc_cls/main.php");
require_once(dirname(__FILE__) . "/toolset/main.php");
require_once(dirname(__FILE__) . "/code_storikaze_power.php");
require_once(dirname(__FILE__) . "/code_storikaze_until.php");
require_once(dirname(__FILE__) . "/code_storikaze_wbr.php" );
require_once(dirname(__FILE__) . "/code_storikaze_prsv.php");
require_once(dirname(__FILE__) . "/code_storikaze_verse.php");
require_once(dirname(__FILE__) . "/code_storikaze_istx.php");
require_once(dirname(__FILE__) . "/code_storikaze_history.php");
require_once(dirname(__FILE__) . "/code_storikaze_adc.php");
require_once(dirname(__FILE__) . "/work_add_social.php");
require_once(dirname(__FILE__) . "/work_add/main.php");
require_once(dirname(__FILE__) . "/menucode/main.php");
?>