C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mampress\wp-includes\classes.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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
<?php

class WP_Query {
    var 
$query;
    var 
$query_vars;
    var 
$queried_object;
    var 
$queried_object_id;

    var 
$posts;
    var 
$post_count 0;
    var 
$current_post = -1;
    var 
$post;

    var 
$is_single false;
    var 
$is_page false;
    var 
$is_archive false;
    var 
$is_date false;
    var 
$is_year false;
    var 
$is_month false;
    var 
$is_day false;
    var 
$is_time false;
    var 
$is_author false;
    var 
$is_category false;
    var 
$is_search false;
    var 
$is_feed false;
    var 
$is_trackback false;
    var 
$is_home false;
    var 
$is_404 false;
    var 
$is_comments_popup false;
    var 
$is_admin false;

    function 
init () {
        
$this->is_single false;
        
$this->is_page false;
        
$this->is_archive false;
        
$this->is_date false;
        
$this->is_year false;
        
$this->is_month false;
        
$this->is_day false;
        
$this->is_time false;
        
$this->is_author false;
        
$this->is_category false;
        
$this->is_search false;
        
$this->is_feed false;
        
$this->is_trackback false;
        
$this->is_home false;
        
$this->is_404 false;
        
$this->is_paged false;
        
$this->is_admin false;

        unset(
$this->posts);
        unset(
$this->query);
        unset(
$this->query_vars);
        unset(
$this->queried_object);
        unset(
$this->queried_object_id);
        
$this->post_count 0;
        
$this->current_post = -1;
    }

    
// Reparse the query vars.
    
function parse_query_vars() {
        
$this->parse_query('');
    }

    
// Parse a query string and set query type booleans.
    
function parse_query ($query) {
        if ( !empty(
$query) || !isset($this->query) ) {
            
$this->init();
            
parse_str($query$qv);
            
$this->query $query;
            
$this->query_vars $qv;
        }

        
$qv['m'] =  (int) $qv['m'];
        
$qv['p'] =  (int) $qv['p'];

        if (
'' != $qv['name']) {
            
$this->is_single true;
        } elseif ( 
$qv['p'] ) {
            
$this->is_single true;
        } elseif ((
'' != $qv['hour']) && ('' != $qv['minute']) &&('' != $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) {
            
// If year, month, day, hour, minute, and second are set, a single 
          // post is being queried.        
            
$this->is_single true;
        } elseif (
'' != $qv['static'] || '' != $qv['pagename'] || '' != $qv['page_id']) {
            
$this->is_page true;
            
$this->is_single false;
        } elseif (!empty(
$qv['s'])) {
            
$this->is_search true;
        } else {
        
// Look for archive queries.  Dates, categories, authors.

            
if ( (int) $qv['second']) {
                
$this->is_time true;
                
$this->is_date true;
            }

            if ( (int) 
$qv['minute']) {
                
$this->is_time true;
                
$this->is_date true;
            }

            if ( (int) 
$qv['hour']) {
                
$this->is_time true;
                
$this->is_date true;
            }

            if ( (int) 
$qv['day']) {
                if (! 
$this->is_date) {
                    
$this->is_day true;
                    
$this->is_date true;
                }
            }

            if ( (int)  
$qv['monthnum']) {
                if (! 
$this->is_date) {
                    
$this->is_month true;
                    
$this->is_date true;
                }
            }

            if ( (int)  
$qv['year']) {
                if (! 
$this->is_date) {
                    
$this->is_year true;
                    
$this->is_date true;
                }
            }

            if ( (int)  
$qv['m']) {
                
$this->is_date true;
                if (
strlen($qv['m']) > 9) {
                    
$this->is_time true;
                } else if (
strlen($qv['m']) > 7) {
                    
$this->is_day true;
                } else if (
strlen($qv['m']) > 5) {
                    
$this->is_month true;
                } else {
                    
$this->is_year true;
                }
            }

            if (
'' != $qv['w']) {
                
$this->is_date true;
            }

            if (empty(
$qv['cat']) || ($qv['cat'] == '0')) {
                
$this->is_category false;
            } else {
                if (
stristr($qv['cat'],'-')) {
                    
$this->is_category false;
                } else {
                    
$this->is_category true;
                }
            }

            if (
'' != $qv['category_name']) {
                
$this->is_category true;
            }
            
            if ((empty(
$qv['author'])) || ($qv['author'] == '0')) {
                
$this->is_author false;
            } else {
                
$this->is_author true;
            }

            if (
'' != $qv['author_name']) {
                
$this->is_author true;
            }

            if ( (
$this->is_date || $this->is_author || $this->is_category)) {
                
$this->is_archive true;
            }
        }

        if (
'' != $qv['feed']) {
            
$this->is_feed true;
        }

        if (
'' != $qv['tb']) {
            
$this->is_trackback true;
        }

        if (
'404' == $qv['error']) {
            
$this->is_404 true;
        }

        if (
'' != $qv['paged']) {
            
$this->is_paged true;
        }

        if (
'' != $qv['comments_popup']) {
            
$this->is_comments_popup true;
        }

        if (
strstr($_SERVER['PHP_SELF'], 'wp-admin/')) {
            
$this->is_admin true;
        }

        if ( ! (
$this->is_archive || $this->is_single || $this->is_page || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup)) {
            
$this->is_home true;
        }

        if ( !empty(
$query) ) {
            
do_action('parse_query', array(&$this));
        }
    }

    function 
get($query_var) {
        if (isset(
$this->query_vars[$query_var])) {
            return 
$this->query_vars[$query_var];
        }

        return 
'';
    }

    function 
set($query_var$value) {
        
$this->query_vars[$query_var] = $value;
    }

    function &
get_posts() {
        global 
$wpdb$pagenow$request$user_ID;

        
// Shorthand.
        
$q $this->query_vars;    

        
// First let's clear some variables
        
$whichcat '';
        
$whichauthor '';
        
$result '';
        
$where '';
        
$limits '';
        
$distinct '';
        
$join '';

        if ( !isset(
$q['posts_per_page']) || $q['posts_per_page'] == )
            
$q['posts_per_page'] = get_settings('posts_per_page');
        if ( !isset(
$q['what_to_show']) )
            
$q['what_to_show'] = get_settings('what_to_show');
        if ( isset(
$q['showposts']) && $q['showposts'] ) {
            
$q['showposts'] = (int) $q['showposts'];
            
$q['posts_per_page'] = $q['showposts'];
        }
        if ( (isset(
$q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && ($this->is_archive || $this->is_search) )
            
$q['posts_per_page'] = $q['posts_per_archive_page'];
        if ( !isset(
$q['nopaging']) ) {
            if (
$q['posts_per_page'] == -1) {
                
$q['nopaging'] = true;
            } else {
                
$q['nopaging'] = false;
            }
        }
        if ( 
$this->is_feed ) {
            
$q['posts_per_page'] = get_settings('posts_per_rss');
            
$q['what_to_show'] = 'posts';
        }

        if (isset(
$q['page'])) {
            
$q['page'] = trim($q['page'], '/');
            
$q['page'] = (int) $q['page'];
        }
    
        
$add_hours intval(get_settings('gmt_offset'));
        
$add_minutes intval(60 * (get_settings('gmt_offset') - $add_hours));
        
$wp_posts_post_date_field "post_date"// "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)";

        // If a month is specified in the querystring, load that month
        
if ( (int) $q['m'] ) {
            
$q['m'] = '' preg_replace('|[^0-9]|'''$q['m']);
            
$where .= ' AND YEAR(post_date)=' substr($q['m'], 04);
            if (
strlen($q['m'])>5)
                
$where .= ' AND MONTH(post_date)=' substr($q['m'], 42);
            if (
strlen($q['m'])>7)
                
$where .= ' AND DAYOFMONTH(post_date)=' substr($q['m'], 62);
            if (
strlen($q['m'])>9)
                
$where .= ' AND HOUR(post_date)=' substr($q['m'], 82);
            if (
strlen($q['m'])>11)
                
$where .= ' AND MINUTE(post_date)=' substr($q['m'], 102);
            if (
strlen($q['m'])>13)
                
$where .= ' AND SECOND(post_date)=' substr($q['m'], 122);
        }

        if ( (int) 
$q['hour'] ) {
            
$q['hour'] = '' intval($q['hour']);
            
$where .= " AND HOUR(post_date)='" $q['hour'] . "'";
        }

        if ( (int) 
$q['minute'] ) {
            
$q['minute'] = '' intval($q['minute']);
            
$where .= " AND MINUTE(post_date)='" $q['minute'] . "'";
        }

        if ( (int) 
$q['second'] ) {
            
$q['second'] = '' intval($q['second']);
            
$where .= " AND SECOND(post_date)='" $q['second'] . "'";
        }

        if ( (int) 
$q['year'] ) {
            
$q['year'] = '' intval($q['year']);
            
$where .= " AND YEAR(post_date)='" $q['year'] . "'";
        }

        if ( (int) 
$q['monthnum'] ) {
            
$q['monthnum'] = '' intval($q['monthnum']);
            
$where .= " AND MONTH(post_date)='" $q['monthnum'] . "'";
        }

        if ( (int) 
$q['day'] ) {
            
$q['day'] = '' intval($q['day']);
            
$where .= " AND DAYOFMONTH(post_date)='" $q['day'] . "'";
        }

        if (
'' != $q['name']) {
            
$q['name'] = sanitize_title($q['name']);
            
$where .= " AND post_name = '" $q['name'] . "'";
        } else if (
'' != $q['pagename']) {
            
$q['pagename'] = sanitize_title(basename(str_replace('%2F''/'urlencode($q['pagename']))));
            
$q['name'] = $q['pagename'];
            
$where .= " AND post_name = '" $q['pagename'] . "'";
        }


        if ( (int) 
$q['w'] ) {
            
$q['w'] = ''.intval($q['w']);
            
$where .= " AND WEEK(post_date, 1)='" $q['w'] . "'";
        }

        if ( 
intval($q['comments_popup']) )
            
$q['p'] = intval($q['comments_popup']);

        
// If a post number is specified, load that post
        
if (($q['p'] != '') && intval($q['p']) != 0) {
            
$q['p'] =  (int) $q['p'];
            
$where ' AND ID = ' $q['p'];
        }

        if ((
$q['page_id'] != '') && (intval($q['page_id']) != 0)) {
            
$q['page_id'] = intval($q['page_id']);
            
$q['p'] = $q['page_id'];
            
$where ' AND ID = '.$q['page_id'];
        }

        
// If a search pattern is specified, load the posts that match
        
if (!empty($q['s'])) {
            
$q['s'] = addslashes_gpc($q['s']);
            
$search ' AND (';
            
$q['s'] = preg_replace('/, +/'' '$q['s']);
            
$q['s'] = str_replace(','' '$q['s']);
            
$q['s'] = str_replace('"'' '$q['s']);
            
$q['s'] = trim($q['s']);
            if (
$q['exact']) {
                
$n '';
            } else {
                
$n '%';
            }
            if (!
$q['sentence']) {
                
$s_array explode(' ',$q['s']);
                
$q['search_terms'] = $s_array;
                
$search .= '((post_title LIKE \''.$n.$s_array[0].$n.'\') OR (post_content LIKE \''.$n.$s_array[0].$n.'\'))';
                for ( 
$i 1$i count($s_array); $i $i 1) {
                    
$search .= ' AND ((post_title LIKE \''.$n.$s_array[$i].$n.'\') OR (post_content LIKE \''.$n.$s_array[$i].$n.'\'))';
                }
                
$search .= ' OR (post_title LIKE \''.$n.$q['s'].$n.'\') OR (post_content LIKE \''.$n.$q['s'].$n.'\')';
                
$search .= ')';
            } else {
                
$search ' AND ((post_title LIKE \''.$n.$q['s'].$n.'\') OR (post_content LIKE \''.$n.$q['s'].$n.'\'))';
            }
        }

        
// Category stuff

        
if ((empty($q['cat'])) || ($q['cat'] == '0') || 
                
// Bypass cat checks if fetching specific posts
                
$this->is_single || $this->is_page )) {
            
$whichcat='';
        } else {
            
$q['cat'] = ''.urldecode($q['cat']).'';
            
$q['cat'] = addslashes_gpc($q['cat']);
            if (
stristr($q['cat'],'-')) {
                
// Note: if we have a negative, we ignore all the positives. It must
                // always mean 'everything /except/ this one'. We should be able to do
                // multiple negatives but we don't :-(
                
$eq '!=';
                
$andor 'AND';
                
$q['cat'] = explode('-',$q['cat']);
                
$q['cat'] = intval($q['cat'][1]);
            } else {
                
$eq '=';
                
$andor 'OR';
            }
            
$join " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) ";
            
$cat_array preg_split('/[,\s]+/'$q['cat']);
            
$whichcat .= ' AND (category_id '.$eq.' '.intval($cat_array[0]);
            
$whichcat .= get_category_children($cat_array[0], ' '.$andor.' category_id '.$eq.' ');
            for (
$i 1$i < (count($cat_array)); $i $i 1) {
                
$whichcat .= ' '.$andor.' category_id '.$eq.' '.intval($cat_array[$i]);
                
$whichcat .= get_category_children($cat_array[$i], ' '.$andor.' category_id '.$eq.' ');
            }
            
$whichcat .= ')';
            if (
$eq == '!=') {
                
$q['cat'] = '-'.$q['cat']; // Put back the knowledge that we are excluding a category.
            
}
        }

        
// Category stuff for nice URIs

        
if ('' != $q['category_name']) {
            if (
stristr($q['category_name'],'/')) {
                
$q['category_name'] = explode('/',$q['category_name']);
                if (
$q['category_name'][count($q['category_name'])-1]) {
                    
$q['category_name'] = $q['category_name'][count($q['category_name'])-1]; // no trailing slash
                
} else {
                    
$q['category_name'] = $q['category_name'][count($q['category_name'])-2]; // there was a trailling slash
                
}
            }
            
$q['category_name'] = sanitize_title($q['category_name']);
            
$tables ", $wpdb->post2cat$wpdb->categories";
            
$join " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) LEFT JOIN $wpdb->categories ON ($wpdb->post2cat.category_id = $wpdb->categories.cat_ID) ";
            
$whichcat " AND (category_nicename = '" $q['category_name'] . "'";
            
$q['cat'] = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '" $q['category_name'] . "'");
            
$whichcat .= get_category_children($q['cat'], " OR category_id = ");
            
$whichcat .= ")";
        }

        
// Author/user stuff

        
if ((empty($q['author'])) || ($q['author'] == '0')) {
            
$whichauthor='';
        } else {
            
$q['author'] = ''.urldecode($q['author']).'';
            
$q['author'] = addslashes_gpc($q['author']);
            if (
stristr($q['author'], '-')) {
                
$eq '!=';
                
$andor 'AND';
                
$q['author'] = explode('-'$q['author']);
                
$q['author'] = ''.intval($q['author'][1]);
            } else {
                
$eq '=';
                
$andor 'OR';
            }
            
$author_array preg_split('/[,\s]+/'$q['author']);
            
$whichauthor .= ' AND (post_author '.$eq.' '.intval($author_array[0]);
            for (
$i 1$i < (count($author_array)); $i $i 1) {
                
$whichauthor .= ' '.$andor.' post_author '.$eq.' '.intval($author_array[$i]);
            }
            
$whichauthor .= ')';
        }

        
// Author stuff for nice URIs

        
if ('' != $q['author_name']) {
            if (
stristr($q['author_name'],'/')) {
                
$q['author_name'] = explode('/',$q['author_name']);
                if (
$q['author_name'][count($q['author_name'])-1]) {
                    
$q['author_name'] = $q['author_name'][count($q['author_name'])-1];#no trailing slash
                
} else {
                    
$q['author_name'] = $q['author_name'][count($q['author_name'])-2];#there was a trailling slash
                
}
            }
            
$q['author_name'] = sanitize_title($q['author_name']);
            
$q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'");
            
$whichauthor .= ' AND (post_author = '.intval($q['author']).')';
        }

        
$where .= $search.$whichcat.$whichauthor;

        if ((empty(
$q['order'])) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC'))) {
            
$q['order']='DESC';
        }

        
// Order by
        
if (empty($q['orderby'])) {
            
$q['orderby']='date '.$q['order'];
        } else {
            
// Used to filter values
            
$allowed_keys = array('author','date','category','title');
            
$q['orderby'] = urldecode($q['orderby']);
            
$q['orderby'] = addslashes_gpc($q['orderby']);
            
$orderby_array explode(' ',$q['orderby']);
            if (!
in_array($orderby_array[0],$allowed_keys)) {
                
$orderby_array[0] = 'date';
            }
            
$q['orderby'] = $orderby_array[0].' '.$q['order'];
            if (
count($orderby_array)>1) {
                for (
$i 1$i < (count($orderby_array)); $i $i 1) {
                    
// Only allow certain values for safety
                    
if (in_array($orderby_array[$i],$allowed_keys)) {
                        
$q['orderby'] .= ',post_'.$orderby_array[$i].' '.$q['order'];
                    }
                }
            }
        }

        
$now gmdate('Y-m-d H:i:59');

        if (
$pagenow != 'post.php' && $pagenow != 'edit.php') {
            
$where .= " AND post_date_gmt <= '$now'";
            
$distinct 'DISTINCT';
        }

        if (
$this->is_page) {
            
$where .= ' AND (post_status = "static")';
        } elseif (
$this->is_single) {
            
$where .= ' AND (post_status != "static")';
        } else {
            
$where .= ' AND (post_status = "publish"';

            if (isset(
$user_ID) && ('' != intval($user_ID)))
                
$where .= " OR post_author = $user_ID AND post_status != 'draft' AND post_status != 'static')";
            else
                
$where .= ')';                
        }

        
// Apply filters on where and join prior to paging so that any
        // manipulations to them are reflected in the paging by day queries.
        
$where apply_filters('posts_where'$where);
        
$join apply_filters('posts_join'$join);

        
// Paging
        
if (empty($q['nopaging']) && ! $this->is_single) {
            
$page $q['paged'];
            if (empty(
$page)) {
                
$page 1;
            }

            if ((
$q['what_to_show'] == 'posts')) {
                
$pgstrt '';
                
$pgstrt = (intval($page) -1) * $q['posts_per_page'] . ', ';
                
$limits 'LIMIT '.$pgstrt.$q['posts_per_page'];
            } elseif (
$q['what_to_show'] == 'days') {
                
$startrow $q['posts_per_page'] * (intval($page)-1);
                
$start_date $wpdb->get_var("SELECT max(post_date) FROM $wpdb->posts $join WHERE (1=1) $where GROUP BY year(post_date), month(post_date), dayofmonth(post_date) ORDER BY post_date DESC LIMIT $startrow,1");
                
$endrow $startrow $q['posts_per_page'] - 1;
                
$end_date $wpdb->get_var("SELECT min(post_date) FROM $wpdb->posts $join WHERE (1=1) $where GROUP BY year(post_date), month(post_date), dayofmonth(post_date) ORDER BY post_date DESC LIMIT $endrow,1");

                if (
$page 1) {
                    
$where .= " AND post_date >= '$end_date' AND post_date <= '$start_date'";
                } else {
                    
$where .= " AND post_date >= '$end_date'";
                }
            }
        }

        
// Apply post-paging filters on where and join.  Only plugins that
        // manipulate paging queries should use these hooks.
        
$where apply_filters('posts_where_paged'$where);
        
$where .= " GROUP BY $wpdb->posts.ID";
        
$join apply_filters('posts_join_paged'$join);
        
$orderby "post_" $q['orderby'];
        
$orderby apply_filters('posts_orderby'$orderby); 
        
$request " SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1".$where." ORDER BY " $orderby $limits";

        
$this->posts $wpdb->get_results($request);

        
// Check post status to determine if post should be displayed.
        
if ($this->is_single) {
            if (
'publish' != $this->posts[0]->post_status) {
                if ( ! (isset(
$user_ID) && ('' != intval($user_ID))) ) {
                    
// User must be logged in to view unpublished posts.
                    
$this->posts = array();
                } else {
                    if (
'draft' == $this->posts[0]->post_status) {
                        
// User must have edit permissions on the draft to preview.
                        
if (! user_can_edit_post($user_ID$this->posts[0]->ID))
                            
$this->posts = array();
                    } elseif (
'private' == $this->posts[0]->post_status) {
                        if (
$this->posts[0]->post_author != $user_ID)
                            
$this->posts = array();
                    }
                }
            }
        }

        
$this->posts apply_filters('the_posts'$this->posts);
        
$this->post_count count($this->posts);
        if (
$this->post_count 0) {
            
$this->post $this->posts[0];
        }

        
update_post_caches($this->posts);
        
        
// Save any changes made to the query vars.
        
$this->query_vars $q;
        return 
$this->posts;
    }

    function 
next_post() {
        
        
$this->current_post++;

        
$this->post $this->posts[$this->current_post];
        return 
$this->post;
    }

    function 
the_post() {
        global 
$post;
        
$post $this->next_post();
        
setup_postdata($post);
    }

    function 
have_posts() {
        if (
$this->current_post $this->post_count) {
            return 
true;
        }

        return 
false;
    }

    function 
rewind_posts() {
        
$this->current_post = -1;
        if (
$this->post_count 0) {
            
$this->post $this->posts[0];
        }
    }
    
    function &
query($query) {
        
$this->parse_query($query);
        return 
$this->get_posts();
    }

    function 
get_queried_object() {
        if (isset(
$this->queried_object)) {
            return 
$this->queried_object;
        }

        
$this->queried_object NULL;
        
$this->queried_object_id 0;

        if (
$this->is_category) {
            
$category = &get_category($this->get('cat'));
            
$this->queried_object = &$category;
            
$this->queried_object_id $this->get('cat');
        } else if (
$this->is_single) {
            
$this->queried_object $this->post;
            
$this->queried_object_id $this->post->ID;
        } else if (
$this->is_page) {
            
$this->queried_object $this->post;
            
$this->queried_object_id $this->post->ID;
        } else if (
$this->is_author) {
            global 
$cache_userdata;
            if (isset(
$cache_userdata[$this->get('author')])) {
                
$this->queried_object $cache_userdata[$this->get('author')];
                
$this->queried_object_id $this->get('author');
            }
        }

        return 
$this->queried_object;
    }

    function 
get_queried_object_id() {
        
$this->get_queried_object();

        if (isset(
$this->queried_object_id)) {
            return 
$this->queried_object_id;
        }

        return 
0;
    }

    function 
WP_Query ($query '') {
        if (! empty(
$query)) {
            
$this->query($query);
        }
    }
}

// Make a global instance.
if (! isset($wp_query)) {
    
$wp_query = new WP_Query();
}

class 
retrospam_mgr {
    var 
$spam_words;
    var 
$comments_list;
    var 
$found_comments;

    function 
retrospam_mgr() {
        global 
$wpdb;

        
$list explode("\n"get_settings('moderation_keys') );
        
$list array_unique$list );
        
$this->spam_words $list;

        
$this->comment_list $wpdb->get_results("SELECT comment_ID AS ID, comment_content AS text, comment_approved AS approved, comment_author_url AS url, comment_author_ip AS ip, comment_author_email AS email FROM $wpdb->comments ORDER BY comment_ID ASC");
    }    
// End of class constructor

    
function move_spam$id_list ) {
        global 
$wpdb;
        
$cnt 0;
        
$id_list explode','$id_list );

        foreach ( 
$id_list as $comment ) {
            if ( 
$wpdb->query("update $wpdb->comments set comment_approved = '0' where comment_ID = '$comment'") ) {
                
$cnt++;
            }
        }
        echo 
"<div class='updated'><p>$cnt comment";
        if (
$cnt != ) echo "s";
        echo 
" moved to the moderation queue.</p></div>\n";
    }    
// End function move_spam

    
function find_spam() {
        
$in_queue 0;

        foreach( 
$this->comment_list as $comment ) {
            if( 
$comment->approved == ) {
                foreach( 
$this->spam_words as $word ) {
                    if ( empty( 
$word ) )
                        continue;
                    
$fulltext strtolower($comment->email.' '.$comment->url.' '.$comment->ip.' '.$comment->text);
                    if( 
strpos$fulltextstrtolower(trim($word)) ) != FALSE ) {
                        
$this->found_comments[] = $comment->ID;
                        break;
                    }
                }
            } else {
                
$in_queue++;
            }
        }
        return array( 
'found' => $this->found_comments'in_queue' => $in_queue );
    }    
// End function find_spam

    
function display_edit_form$counters ) {
        
$numfound count($counters[found]);
        
$numqueue $counters[in_queue];

        
$body '<p>' sprintf(__('Suspected spam comments: <strong>%s</strong>'), $numfound) . '</p>';

        if ( 
count($counters[found]) > ) {
            
$id_list implode','$counters[found] );
            
$body .= '<p><a href="options-discussion.php?action=retrospam&amp;move=true&amp;ids='.$id_list.'">'__('Move suspect comments to moderation queue &raquo;') . '</a></p>';

        }
        
$head '<div class="wrap"><h2>' __('Check Comments Results:') . '</h2>';

        
$foot .= '<p><a href="options-discussion.php">' __('&laquo; Return to Discussion Options page.') . '</a></p></div>';
        
        return 
$head $body $foot;
    }     
// End function display_edit_form

}

class 
WP_Rewrite {
    var 
$permalink_structure;
    var 
$category_base;
    var 
$category_structure;
    var 
$author_base 'author';
    var 
$author_structure;
    var 
$date_structure;
    var 
$page_structure;
    var 
$search_base 'search';
    var 
$search_structure;
    var 
$comments_base 'comments';
    var 
$feed_base 'feed';
    var 
$comments_feed_structure;
    var 
$feed_structure;
    var 
$front;
    var 
$root '';
    var 
$index 'index.php';
    var 
$matches '';
    var 
$rules;
    var 
$rewritecode 
        array(
                    
'%year%',
                    
'%monthnum%',
                    
'%day%',
                    
'%hour%',
                    
'%minute%',
                    
'%second%',
                    
'%postname%',
                    
'%post_id%',
                    
'%category%',
                    
'%author%',
                    
'%pagename%',
                    
'%search%'
                    
);

    var 
$rewritereplace 
        array(
                    
'([0-9]{4})',
                    
'([0-9]{1,2})',
                    
'([0-9]{1,2})',
                    
'([0-9]{1,2})',
                    
'([0-9]{1,2})',
                    
'([0-9]{1,2})',
                    
'([^/]+)',
                    
'([0-9]+)',
                    
'(.+?)',
                    
'([^/]+)',
                    
'([^/]+)',
                    
'(.+)'
                    
);

    var 
$queryreplace 
        array (
                     
'year=',
                     
'monthnum=',
                     
'day=',
                     
'hour=',
                     
'minute=',
                     
'second=',
                     
'name=',
                     
'p=',
                     
'category_name=',
                     
'author_name=',
                     
'pagename=',
                     
's='
                     
);

    var 
$feeds = array ('feed''rdf''rss''rss2''atom');

    function 
using_permalinks() {
        if (empty(
$this->permalink_structure))
            return 
false;
        else
            return 
true;
    }                    

    function 
using_index_permalinks() {
    if (empty(
$this->permalink_structure)) {
            return 
false;
    }

    
// If the index is not in the permalink, we're using mod_rewrite.
    
if (preg_match('#^/*' $this->index '#'$this->permalink_structure)) {
      return 
true;
    }
    
    return 
false;
    }

    function 
using_mod_rewrite_permalinks() {
        if ( 
$this->using_permalinks() && ! $this->using_index_permalinks())
            return 
true;
        else
            return 
false;
    }                    

    function 
preg_index($number) {
    
$match_prefix '$';
    
$match_suffix '';
    
    if (! empty(
$this->matches)) {
            
$match_prefix '$' $this->matches '['
            
$match_suffix ']';
    }        
    
    return 
"$match_prefix$number$match_suffix";        
    }

    function 
page_rewrite_rules() {
        
$uris get_settings('page_uris');

        
$rewrite_rules = array();
        
$page_structure $this->get_page_permastruct();
        if( 
is_array$uris ) )
            {
                foreach (
$uris as $uri => $pagename) {
                    
$this->add_rewrite_tag('%pagename%'"($uri)"'pagename=');
                    
$rewrite_rules += $this->generate_rewrite_rules($page_structure);
                }
            }

        return 
$rewrite_rules;
    }

    function 
get_date_permastruct() {
        if (isset(
$this->date_structure)) {
            return 
$this->date_structure;
        }

    if (empty(
$this->permalink_structure)) {
            
$this->date_structure '';
            return 
false;
        }
        
        
// The date permalink must have year, month, and day separated by slashes.
        
$endians = array('%year%/%monthnum%/%day%''%day%/%monthnum%/%year%''%monthnum%/%day%/%year%');

        
$this->date_structure '';
        
$date_endian '';

        foreach (
$endians as $endian) {
            if (
false !== strpos($this->permalink_structure$endian)) {
                
$date_endian$endian;
                break;
            }
        } 

        if ( empty(
$date_endian) )
            
$date_endian '%year%/%monthnum%/%day%';

        
// Do not allow the date tags and %post_id% to overlap in the permalink
        // structure. If they do, move the date tags to $front/date/.  
        
$front $this->front;
        
preg_match_all('/%.+?%/'$this->permalink_structure$tokens);
        
$tok_index 1;
        foreach (
$tokens[0] as $token) {
            if ( (
$token == '%post_id%') && ($tok_index <= 3) ) {
                
$front $front 'date/';
                break;
            }
        }

        
$this->date_structure $front $date_endian;

        return 
$this->date_structure;
    }

    function 
get_year_permastruct() {
        
$structure $this->get_date_permastruct($permalink_structure);

        if (empty(
$structure)) {
            return 
false;
        }

        
$structure str_replace('%monthnum%'''$structure);
        
$structure str_replace('%day%'''$structure);

        
$structure preg_replace('#/+#''/'$structure);

        return 
$structure;
    }

    function 
get_month_permastruct() {
        
$structure $this->get_date_permastruct($permalink_structure);

        if (empty(
$structure)) {
            return 
false;
        }

        
$structure str_replace('%day%'''$structure);

        
$structure preg_replace('#/+#''/'$structure);

        return 
$structure;
    }

    function 
get_day_permastruct() {
        return 
$this->get_date_permastruct($permalink_structure);
    }

    function 
get_category_permastruct() {
        if (isset(
$this->category_structure)) {
            return 
$this->category_structure;
        }

    if (empty(
$this->permalink_structure)) {
            
$this->category_structure '';
            return 
false;
        }

        if (empty(
$this->category_base))
            
$this->category_structure $this->front 'category/';
        else
            
$this->category_structure $this->category_base '/';

        
$this->category_structure .= '%category%';
        
        return 
$this->category_structure;
    }

    function 
get_author_permastruct() {
        if (isset(
$this->author_structure)) {
            return 
$this->author_structure;
        }

    if (empty(
$this->permalink_structure)) {
            
$this->author_structure '';
            return 
false;
        }

        
$this->author_structure $this->front $this->author_base '/%author%';

        return 
$this->author_structure;
    }

    function 
get_search_permastruct() {
        if (isset(
$this->search_structure)) {
            return 
$this->search_structure;
        }

    if (empty(
$this->permalink_structure)) {
            
$this->search_structure '';
            return 
false;
        }

        
$this->search_structure $this->root $this->search_base '/%search%';

        return 
$this->search_structure;
    }

    function 
get_page_permastruct() {
        if (isset(
$this->page_structure)) {
            return 
$this->page_structure;
        }

    if (empty(
$this->permalink_structure)) {
            
$this->page_structure '';
            return 
false;
        }

        
$this->page_structure $this->root '%pagename%';

        return 
$this->page_structure;
    }

    function 
get_feed_permastruct() {
        if (isset(
$this->feed_structure)) {
            return 
$this->feed_structure;
        }

    if (empty(
$this->permalink_structure)) {
            
$this->feed_structure '';
            return 
false;
        }

        
$this->feed_structure $this->root $this->feed_base '/%feed%';

        return 
$this->feed_structure;
    }

    function 
get_comment_feed_permastruct() {
        if (isset(
$this->comment_feed_structure)) {
            return 
$this->comment_feed_structure;
        }

    if (empty(
$this->permalink_structure)) {
            
$this->comment_feed_structure '';
            return 
false;
        }

        
$this->comment_feed_structure $this->root $this->comments_base '/' $this->feed_base '/%feed%';

        return 
$this->comment_feed_structure;
    }

    function 
add_rewrite_tag($tag$pattern$query) {
        
// If the tag already exists, replace the existing pattern and query for
        // that tag, otherwise add the new tag, pattern, and query to the end of
        // the arrays.
        
$position array_search($tag$this->rewritecode);        
        if (
FALSE !== $position && NULL !== $position) {
            
$this->rewritereplace[$position] = $pattern;
            
$this->queryreplace[$position] = $query;            
        } else {
            
$this->rewritecode[] = $tag;
            
$this->rewritereplace[] = $pattern;
            
$this->queryreplace[] = $query;
        }
    }

    function 
generate_rewrite_rules($permalink_structure$page true$feed true$forcomments false$walk_dirs true) {
        
$feedregex2 '';
        foreach (
$this->feeds as $feed_name) {
            
$feedregex2 .= $feed_name '|';
        }
        
$feedregex2 '(' trim($feedregex2'|') .  ')/?$';
        
$feedregex $this->feed_base  '/' $feedregex2;

        
$trackbackregex 'trackback/?$';
        
$pageregex 'page/?([0-9]{1,})/?$';
        
        
$front substr($permalink_structure0strpos($permalink_structure'%'));
        
preg_match_all('/%.+?%/'$permalink_structure$tokens);

        
$num_tokens count($tokens[0]);

        
$index $this->index;
        
$feedindex $index;
        
$trackbackindex $index;
        for (
$i 0$i $num_tokens; ++$i) {
            if (
$i) {
                
$queries[$i] = $queries[$i 1] . '&';
            }
             
            
$query_token str_replace($this->rewritecode$this->queryreplace$tokens[0][$i]) . $this->preg_index($i+1);
            
$queries[$i] .= $query_token;
        }

        
$structure $permalink_structure;
        if (
$front != '/') {
            
$structure str_replace($front''$structure);
        }
        
$structure trim($structure'/');
        if (
$walk_dirs) {
            
$dirs explode('/'$structure);
        } else {
            
$dirs[] = $structure;
        }
        
$num_dirs count($dirs);

        
$front preg_replace('|^/+|'''$front);

        
$post_rewrite = array();
        
$struct $front;
        for (
$j 0$j $num_dirs; ++$j) {
            
$struct .= $dirs[$j] . '/';
            
$struct ltrim($struct'/');
            
$match str_replace($this->rewritecode$this->rewritereplace$struct);
            
$num_toks preg_match_all('/%.+?%/'$struct$toks);
            
$query $queries[$num_toks 1];

            
$pagematch $match $pageregex;
            
$pagequery $index '?' $query '&paged=' $this->preg_index($num_toks 1);

            
$feedmatch $match $feedregex;
            
$feedquery $feedindex '?' $query '&feed=' $this->preg_index($num_toks 1);

            
$feedmatch2 $match $feedregex2;
            
$feedquery2 $feedindex '?' $query '&feed=' $this->preg_index($num_toks 1);

            if (
$forcomments) {
                
$feedquery .= '&withcomments=1';
                
$feedquery2 .= '&withcomments=1';
            }

            
$rewrite = array();
            if (
$feed
                
$rewrite = array($feedmatch => $feedquery$feedmatch2 => $feedquery2);
            if (
$page)
                
$rewrite $rewrite + array($pagematch => $pagequery);

            if (
$num_toks) {
                
$post 0;
                if (
strstr($struct'%postname%') || strstr($struct'%post_id%')
                        || 
strstr($struct'%pagename%')
                        || (
strstr($struct'%year%') &&  strstr($struct'%monthnum%') && strstr($struct'%day%') && strstr($struct'%hour%') && strstr($struct'%minute') && strstr($struct'%second%'))) {
                    
$post 1;
                    
$trackbackmatch $match $trackbackregex;
                    
$trackbackquery $trackbackindex '?' $query '&tb=1';
                    
$match rtrim($match'/');
                    
$match $match '(/[0-9]+)?/?$';
                    
$query $index '?' $query '&page=' $this->preg_index($num_toks 1);
                } else {
                    
$match .= '?$';
                    
$query $index '?' $query;
                }
                        
                
$rewrite $rewrite + array($match => $query);

                if (
$post) {
                    
$rewrite = array($trackbackmatch => $trackbackquery) + $rewrite;
                }
            }

            
$post_rewrite $rewrite $post_rewrite;
        }

        return 
$post_rewrite;
    }

    function 
generate_rewrite_rule($permalink_structure$walk_dirs false) {
        return 
$this->generate_rewrite_rules($permalink_structurefalsefalsefalse$walk_dirs);
    }

    
/* rewrite_rules
     * Construct rewrite matches and queries from permalink structure.
     * Returns an associate array of matches and queries.
     */
    
function rewrite_rules() {
        
$rewrite = array();

        if (empty(
$this->permalink_structure)) {
            return 
$rewrite;
        }

        
// Post
        
$post_rewrite $this->generate_rewrite_rules($this->permalink_structure);
        
$post_rewrite apply_filters('post_rewrite_rules'$post_rewrite);

        
// Date
        
$date_rewrite $this->generate_rewrite_rules($this->get_date_permastruct());
        
$date_rewrite apply_filters('date_rewrite_rules'$date_rewrite);
        
        
// Root
        
$root_rewrite $this->generate_rewrite_rules($this->root '/');
        
$root_rewrite apply_filters('root_rewrite_rules'$root_rewrite);

        
// Comments
        
$comments_rewrite $this->generate_rewrite_rules($this->root $this->comments_basetruetruetrue);
        
$comments_rewrite apply_filters('comments_rewrite_rules'$comments_rewrite);

        
// Search
        
$search_structure $this->get_search_permastruct();
        
$search_rewrite $this->generate_rewrite_rules($search_structure);
        
$search_rewrite apply_filters('search_rewrite_rules'$search_rewrite);

        
// Categories
        
$category_rewrite $this->generate_rewrite_rules($this->get_category_permastruct());
        
$category_rewrite apply_filters('category_rewrite_rules'$category_rewrite);

        
// Authors
        
$author_rewrite $this->generate_rewrite_rules($this->get_author_permastruct());
        
$author_rewrite apply_filters('author_rewrite_rules'$author_rewrite);

        
// Pages
        
$page_rewrite $this->page_rewrite_rules();
        
$page_rewrite apply_filters('page_rewrite_rules'$page_rewrite);

        
// Put them together.
        
$this->rules $page_rewrite $root_rewrite $comments_rewrite $search_rewrite $category_rewrite $author_rewrite $date_rewrite $post_rewrite;

        
do_action('generate_rewrite_rules', array(&$this));
        
$this->rules apply_filters('rewrite_rules_array'$this->rules);
        return 
$this->rules;
    }

    function 
wp_rewrite_rules() {
        
$this->matches 'matches';
        return 
$this->rewrite_rules();
    }

    function 
mod_rewrite_rules() {
        if ( ! 
$this->using_permalinks()) {
            return 
'';
        }

        
$site_root parse_url(get_settings('siteurl'));
        
$site_root trailingslashit($site_root['path']);

        
$home_root parse_url(get_settings('home'));
        
$home_root trailingslashit($home_root['path']);
    
        
$rules "<IfModule mod_rewrite.c>\n";
        
$rules .= "RewriteEngine On\n";
        
$rules .= "RewriteBase $home_root\n";
        
$this->matches '';
        
$rewrite $this->rewrite_rules();
        
$num_rules count($rewrite);
        
$rules .= "RewriteCond %{REQUEST_FILENAME} -f [OR]\n" .
            
"RewriteCond %{REQUEST_FILENAME} -d\n" .
            
"RewriteRule ^.*$ - [S=$num_rules]\n";

        foreach (
$rewrite as $match => $query) {
            
// Apache 1.3 does not support the reluctant (non-greedy) modifier.
            
$match str_replace('.+?''.+'$match);

            
// If the match is unanchored and greedy, prepend rewrite conditions
            // to avoid infinite redirects and eclipsing of real files.
            
if ($match == '(.+)/?$' || $match == '([^/]+)/?$' ) {
                
//nada.
            
}

            if (
strstr($query$this->index)) {
                
$rules .= 'RewriteRule ^' $match ' ' $home_root $query " [QSA,L]\n";
            } else {
                
$rules .= 'RewriteRule ^' $match ' ' $site_root $query " [QSA,L]\n";
            }
        }
        
$rules .= "</IfModule>\n";

        
$rules apply_filters('mod_rewrite_rules'$rules);
        
$rules apply_filters('rewrite_rules'$rules);  // Deprecated

        
return $rules;
    }

    function 
init() {
        
$this->permalink_structure get_settings('permalink_structure');
        
$this->front substr($this->permalink_structure0strpos($this->permalink_structure'%'));        
        
$this->root '';
        if (
$this->using_index_permalinks()) {
            
$this->root $this->index '/';
        }
        
$this->category_base get_settings('category_base');
        unset(
$this->category_structure);
        unset(
$this->author_structure);
        unset(
$this->date_structure);
        unset(
$this->page_structure);
        unset(
$this->search_structure);
        unset(
$this->feed_structure);
        unset(
$this->comment_feed_structure);
    }

    function 
set_permalink_structure($permalink_structure) {
        if (
$permalink_structure != $this->permalink_structure) {
            
update_option('permalink_structure'$permalink_structure);
            
$this->init();
        }
    }

    function 
set_category_base($category_base) {
        if (
$category_base != $this->category_base) {
            
update_option('category_base'$category_base);
            
$this->init();
        }
    }

    function 
WP_Rewrite() {
        
$this->init();
    }
}

// Make a global instance.
if (! isset($wp_rewrite)) {
    
$wp_rewrite = new WP_Rewrite();
}

?>