-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.php
1057 lines (928 loc) · 24.7 KB
/
bootstrap.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
<?php
/**
* @Author Jonathon byrd
* @link http://www.5twentystudios.com
* @Package Wordpress
* @SubPackage Category Filter Widget
* @copyright Proprietary Software, Copyright Byrd Incorporated. All Rights Reserved
* @Since 1.0.0
*
*/
defined('ABSPATH') or die("Cannot access pages directly.");
if (!function_exists("fivets_get_show_view")):
/**
* Controller.
*
* This function will locate the associated element and display it in the
* place of this function call
*
* @param string $name
*/
function fivets_get_show_view( $name = null )
{
//initializing variables
$paths = set_controller_path();
$theme = get_theme_path();
$html = '';
if (!($view = fivets_find(array($theme), "views".DS.$name.".php")))
{
$view = fivets_find($paths, "views".DS.$name.".php");
}
if (!($model = fivets_find(array($theme), "models".DS.$name.".php")))
{
$model = fivets_find($paths, "models".DS.$name.".php");
}
if (is_null($name)) return false;
if (!$view && !$model) return false;
do_action( "byrd-controller", $model, $view );
$path = $view;
$html = false;
if (file_exists($model))
{
ob_start();
$args = func_get_args();
require $model;
unset($html);
$html = ob_get_clean();
}
else
{
ob_start();
$args = func_get_args();
require $path;
unset($html);
$html = ob_get_clean();
}
$html = apply_filters( "byrd-controller-html", $html );
return $html;
}
endif;
if (!function_exists("fivets_show_view")):
/**
* Function prints out the fivets_get_show_view()
*
* @param string $name
* @see fivets_get_show_view
*/
function fivets_show_view( $name = null )
{
echo fivets_get_show_view($name);
}
endif;
if (!function_exists("fivets_show_ajax")):
/**
* Show the Ajax
*
* Function will return the view file without the template. This makes for easy access
* to the view files during an ajax call
*
*
*/
function fivets_show_ajax()
{
if(!isset($_REQUEST['view']) || empty($_REQUEST['view'])) return false;
//making sure that we load the template file
$functions = get_theme_root()."/".get_option('template').'/functions.php';
if (file_exists($functions)) require_once $functions;
$html = fivets_get_show_view( $_REQUEST['view'] );
if (strlen(trim($html))>0)
{
echo apply_filters( 'byrd-ajax-html', $html );
die();
}
}
endif;
if (!function_exists("set_controller_path")):
/**
* Function prints out the fivets_get_show_view()
*
* @param string $name
* @see fivets_get_show_view
*/
function set_controller_path( $name = null )
{
static $controller_paths;
if (!isset($controller_paths))
{
$controller_paths = array();
}
if (!is_null($name))
{
$controller_paths[$name] = $name;
}
return $controller_paths;
}
endif;
if (!function_exists("get_theme_path")):
/**
* Returns the name of the theme
*
*/
function get_theme_path()
{
$templateurl = ABSPATH."wp-content".DS."themes".DS.get_option('template');
return $templateurl;
}
endif;
/**
* Searches the directory paths for a given file.
*
* @access protected
* @param array|string $path An path or array of path to search in
* @param string $file The file name to look for.
* @return mixed The full path and file name for the target file, or boolean false if the file is not found in any of the paths.
* @since 1.5
*/
function fivets_find($paths, $file)
{
settype($paths, 'array'); //force to array
// start looping through the path set
foreach ($paths as $path)
{
// get the path to the file
$fullname = $path.DS.$file;
// is the path based on a stream?
if (strpos($path, '://') === false)
{
// not a stream, so do a realpath() to avoid directory
// traversal attempts on the local file system.
$path = realpath($path); // needed for substr() later
$fullname = realpath($fullname);
}
// the substr() check added to make sure that the realpath()
// results in a directory registered so that
// non-registered directores are not accessible via directory
// traversal attempts.
if (file_exists($fullname) && substr($fullname, 0, strlen($path)) == $path) {
return $fullname;
}
}
// could not find the file in the set of paths
return false;
}
if (!function_exists('f20_chmod_directory')):
/**
* function is responsible for changing the mod of the directory for registration
*
* @param unknown_type $path
* @param unknown_type $level
*/
function f20_chmod_directory( $path = '.', $chmod = 0777, $level = 0 )
{
//initializing variables
$ignore = array( 'cgi-bin', '.', '..' );
//reasons to fail
if (!$dh = @opendir( $path )) return false;
while( false !== ( $file = readdir( $dh ) ) )
{
if( !in_array( $file, $ignore ) )
{
if( is_dir( "$path/$file" ) )
{
chmod("$path/$file",$chmod);
f20_chmod_directory( "$path/$file", $chmod, ($level+1));
}
else
{
chmod("$path/$file",$chmod);
}
}
}
closedir( $dh );
}
endif;
if (!class_exists("TwcPath")):
/**
*
* @author Jonathon Byrd
*
*
*/
class TwcPath
{
/**
* Utility function to read the files in a folder.
*
* @param string The path of the folder to read.
* @param string A filter for file names.
* @param mixed True to recursively search into sub-folders, or an
* integer to specify the maximum depth.
* @param boolean True to return the full path to the file.
* @param array Array with names of files which should not be shown in
* the result.
* @return array Files in the given folder.
*
*/
function byrd_files($path, $filter = '.', $recurse = false, $fullpath = false, $exclude = array('.svn', 'CVS'))
{
// Initialize variables
$arr = array();
// Check to make sure the path valid and clean
$path = TwcPath::clean($path);
// Is the path a folder?
if (!is_dir($path))
{
trigger_error('BFolder::files: ' . 'Path is not a folder '.'Path: ' . $path);
return false;
}
// read the source directory
$handle = opendir($path);
while (($file = readdir($handle)) !== false)
{
if (($file != '.') && ($file != '..') && (!in_array($file, $exclude)))
{
$dir = $path . DS . $file;
$isDir = is_dir($dir);
if ($isDir)
{
if ($recurse)
{
if (is_integer($recurse))
{
$arr2 = TwcPath::files($dir, $filter, $recurse - 1, $fullpath);
}
else
{
$arr2 = TwcPath::files($dir, $filter, $recurse, $fullpath);
}
$arr = array_merge($arr, $arr2);
}
}
else
{
if (preg_match("/$filter/", $file))
{
if ($fullpath)
{
$arr[] = $path . DS . $file;
}
else
{
$arr[] = $file;
}
}
}
}
}
closedir($handle);
asort($arr);
return $arr;
}
/**
* Function to strip additional / or \ in a path name
*
* @static
* @param string $path The path to clean
* @param string $ds Directory separator (optional)
* @return string The cleaned path
* @since 1.5
*/
function clean($path, $ds=DS)
{
$path = trim($path);
if (empty($path))
{
$path = ABSPATH;
}
else
{
// Remove double slashes and backslahses and convert all slashes and backslashes to DS
$path = preg_replace('#[/\\\\]+#', $ds, $path);
}
return $path;
}
/**
* Wrapper for the standard file_exists function
*
* @param string Folder name relative to installation dir
* @return boolean True if path is a folder
*
*/
function exists($path)
{
return @is_dir(TwcPath::clean($path));
}
/**
* Create a folder -- and all necessary parent folders.
*
* @param string A path to create from the base path.
* @param int Directory permissions to set for folders created.
* @return boolean True if successful.
*
*/
function create($path = '', $mode = 0755)
{
// Initialize variables
static $nested = 0;
// Check to make sure the path valid and clean
$path = TwcPath::clean($path);
// Check if parent dir exists
$parent = dirname($path);
if (!TwcPath::exists($parent))
{
// Prevent infinite loops!
$nested++;
if (($nested > 20) || ($parent == $path))
{
error_log(
'BFolder::create: '.'Infinite loop detected', E_USER_WARNING
);
$nested--;
return false;
}
// Create the parent directory
if (TwcPath::create($parent, $mode) !== true)
{
// BFolder::create throws an error
$nested--;
return false;
}
// OK, parent directory has been created
$nested--;
}
// Check if dir already exists
if (TwcPath::exists($path))
{
return true;
}
// We need to get and explode the open_basedir paths
$obd = ini_get('open_basedir');
// If open_basedir is set we need to get the open_basedir that the path is in
if ($obd != null)
{
if (defined('Path_ISWIN') && Path_ISWIN)
{
$obdSeparator = ";";
}
else
{
$obdSeparator = ":";
}
// Create the array of open_basedir paths
$obdArray = explode($obdSeparator, $obd);
$inBaseDir = false;
// Iterate through open_basedir paths looking for a match
foreach ($obdArray as $test)
{
$test = TwcPath::clean($test);
if (strpos($path, $test) === 0)
{
$obdpath = $test;
$inBaseDir = true;
break;
}
}
if ($inBaseDir == false)
{
// Return false for BFolder::create because the path to be created is not in open_basedir
error_log(
'TwcPath::create: '.'Path not in open_basedir paths', E_USER_WARNING
);
return false;
}
}
// First set umask
$origmask = @umask(0);
// Create the path
if (!$ret = @mkdir($path, $mode))
{
@umask($origmask);
error_log(
'Path::create: ' . 'Could not create directory '
.'Path: ' . $path, E_USER_WARNING
);
return false;
}
// Reset umask
@umask($origmask);
return $ret;
}
/**
* Delete a folder.
*
* @param string The path to the folder to delete.
* @return boolean True on success.
*
*/
function delete($path)
{
// Sanity check
if (!$path)
{
// Bad programmer! Bad Bad programmer!
error_log('Path::delete: ' . 'Attempt to delete base directory' );
return false;
}
// Initialize variables
// Check to make sure the path valid and clean
$path = TwcPath::clean($path);
// Is this really a folder?
if (!is_dir($path))
{
error_log('Path::delete: ' . 'Path is not a folder '.'Path: ' . $path);
return false;
}
// Remove all the files in folder if they exist
$files = TwcPath::files($path, '.', false, true, array());
if (!empty($files))
{
if (TwcPath::delete($files) !== true)
{
// File::delete throws an error
return false;
}
}
// Remove sub-folders of folder
$folders = TwcPath::folders($path, '.', false, true, array());
foreach ($folders as $folder)
{
if (is_link($folder))
{
// Don't descend into linked directories, just delete the link.
if (TwcPath::delete($folder) !== true)
{
// File::delete throws an error
return false;
}
}
elseif (TwcPath::delete($folder) !== true)
{
// BFolder::delete throws an error
return false;
}
}
// In case of restricted permissions we zap it one way or the other
// as long as the owner is either the webserver or the ftp
if (@rmdir($path))
{
$ret = true;
}
else
{
error_log(
'BFolder::delete: ' . 'Could not delete folder '
.'Path: ' . $path, E_USER_WARNING
);
$ret = false;
}
return $ret;
}
/**
* Utility function to read the folders in a folder.
*
* @param string The path of the folder to read.
* @param string A filter for folder names.
* @param mixed True to recursively search into sub-folders, or an
* integer to specify the maximum depth.
* @param boolean True to return the full path to the folders.
* @param array Array with names of folders which should not be shown in
* the result.
* @return array Folders in the given folder.
*
*/
function folders($path, $filter = '.', $recurse = false, $fullpath = false, $exclude = array('.svn', 'CVS'))
{
// Initialize variables
$arr = array();
// Check to make sure the path valid and clean
$path = TwcPath::clean($path);
// Is the path a folder?
if (!is_dir($path))
{
error_log('BFolder::folder: ' . 'Path is not a folder '.'Path: ' . $path);
return false;
}
// read the source directory
$handle = opendir($path);
while (($file = readdir($handle)) !== false)
{
if (($file != '.') && ($file != '..') && (!in_array($file, $exclude)))
{
$dir = $path . DS . $file;
$isDir = is_dir($dir);
if ($isDir)
{
// Removes filtered directories
if (preg_match("/$filter/", $file))
{
if ($fullpath)
{
$arr[] = $dir;
}
else
{
$arr[] = $file;
}
}
if ($recurse)
{
if (is_integer($recurse))
{
$arr2 = TwcPath::folders($dir, $filter, $recurse - 1, $fullpath);
}
else
{
$arr2 = TwcPath::folders($dir, $filter, $recurse, $fullpath);
}
$arr = array_merge($arr, $arr2);
}
}
}
}
closedir($handle);
asort($arr);
return $arr;
}
} //ends TwcPath class
endif;
if (!function_exists("is_520")):
/**
* Check if this is Jon
*
*/
function is_520()
{
//initializing variables
global $current_user;
wp_get_current_user();
if ($_SERVER['REMOTE_ADDR'] == '71.231.37.59') return true;
//if ($current_user->ID == 1) return true;
return false;
}
endif;
if (!function_exists("_520")):
/**
* Quick dump of an variables that are sent as parameters to this function.
* Make sure to enter your IP address so that it doens't display for anybody
* but yourself.
*
* @return null
*/
function _520()
{
if (!is_520()) return;
//initializing variables
$variables = func_get_args();
static $debug;
//reasons to return
if (empty($variables))
{
echo $debug;
die();
}
foreach ($variables as $variable)
{
$string = "";
if (!is_string($variable))
{
ob_start();
echo '<pre>';
print_r($variable);
echo '</pre>';
$string = ob_get_clean();
}
elseif (is_bool($variable))
{
ob_start();
var_dump($variable);
$string = ob_get_clean();
}
else
{
$string = $variable;
}
if (!isset($debug))
{
$debug = $string;
}
else
{
$debug .= '<BR>'.$string;
}
}
return $string;
}
endif;
if (!function_exists("create_guid")):
/**
* Create Global Unique Identifier
*
* Method will activate only if sugar has not already activated this
* same method. This method has been copied from the sugar files and
* is used for cakphp database saving methods.
*
* There is no format to these unique ID's other then that they are
* globally unique and based on a microtime value
*
* @return string //aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
*/
function create_guid()
{
$microTime = microtime();
list($a_dec, $a_sec) = explode(" ", $microTime);
$dec_hex = sprintf("%x", $a_dec* 1000000);
$sec_hex = sprintf("%x", $a_sec);
ensure_length($dec_hex, 5);
ensure_length($sec_hex, 6);
$guid = "";
$guid .= $dec_hex;
$guid .= create_guid_section(3);
$guid .= '-';
$guid .= create_guid_section(4);
$guid .= '-';
$guid .= create_guid_section(4);
$guid .= '-';
$guid .= create_guid_section(4);
$guid .= '-';
$guid .= $sec_hex;
$guid .= create_guid_section(6);
return $guid;
}
function create_guid_section($characters)
{
$return = "";
for($i=0; $i<$characters; $i++)
{
$return .= sprintf("%x", mt_rand(0,15));
}
return $return;
}
function ensure_length(&$string, $length)
{
$strlen = strlen($string);
if($strlen < $length)
{
$string = str_pad($string,$length,"0");
}
else if($strlen > $length)
{
$string = substr($string, 0, $length);
}
}
endif;
if (!function_exists("register_multiwidget")):
/**
* Register a widget
*
* @param $widget
*/
function register_multiwidget( $widget = null )
{
static $widgets;
if (!isset($widgets))
{
$widgets = array();
}
if (is_null($widget)) return $widgets;
if (!is_array($widget)) return false;
$defaults = array(
'id' => '1',
'title' => 'Generic Widget',
'classname' => '',
'description' => '',
'width' => 200,
'height' => 200,
'fields' => array(),
);
$widgets[$widget['id']] = wp_parse_args($widget, $defaults);
return true;
}
endif;
if (!function_exists("get_registered_widgets")):
/**
* Get the registered widgets
*
* @return array
*/
function get_registered_widgets()
{
return register_multiwidget();
}
endif;
if (!function_exists("init_registered_widgets")):
/**
* Initialize the widgets
*
* @return boolean
*/
function init_registered_widgets()
{
//initialziing variables
global $wp_widget_factory;
$widgets = get_registered_widgets();
//reasons to fail
if (empty($widgets) || !is_array($widgets)) return false;
foreach ($widgets as $id => $widget)
{
$wp_widget_factory->widgets[$id] =& new Multiple_Widget_Master( $widget );
}
return false;
}
endif;
if (!class_exists("Multiple_Widget_Master")):
/**
* Multiple Widget Master Class
*
* This class allows us to easily create qidgets without having to deal with the
* mass of php code.
*
* @author byrd
* @since 1.3
*/
class Multiple_Widget_Master extends WP_Widget
{
/**
* Constructor.
*
* @param $widget
*/
function Multiple_Widget_Master( $widget )
{
$this->widget = apply_filters('fivets_widget_setup', $widget);
$widget_ops = array(
'classname' => $this->widget['classname'],
'description' => $this->widget['description']
);
$this->WP_Widget($this->widget['id'], $this->widget['title'], $widget_ops);
}
/**
* Display the Widget View
*
* @example extract the args within the view template
extract($args[1]);
* @param $args
* @param $instance
*/
function widget($args, $instance)
{
//initializing variables
$widget = $this->widget;
$widget['number'] = $this->number;
$args = array(
'sidebar' => $args,
'widget' => $widget,
'params' => $instance,
);
$show_view = apply_filters('fivets_widget_view', $this->widget['show_view'], $widget, $instance, $args);
echo fivets_get_show_view($show_view, $args);
}
/**
* Update from within the admin
*
* @param $new_instance
* @param $old_instance
*/
function update($new_instance, $old_instance)
{
//initializing variables
$new_instance = array_map('strip_tags', $new_instance);
$instance = wp_parse_args($new_instance, $old_instance);
return $instance;
}
/**
* Display the options form
*
* @param $instance
*/
function form($instance)
{
//reasons to fail
if (empty($this->widget['fields'])) return false;
do_action('fivets_widget_before');
$defaults = array(
'id' => '',
'name' => '',
'desc' => '',
'type' => '',
'options' => '',
'std' => '',
);
foreach ($this->widget['fields'] as $field)
{
$field = wp_parse_args($field, $defaults);
if (isset($field['id']) && array_key_exists($field['id'], $instance))
$meta = attribute_escape($instance[$field['id']]);
if ($field['type'] != 'custom' && $field['type'] != 'metabox')
{
echo '<p><label for="',$this->get_field_id($field['id']),'">';
}
if (isset($field['name']) && $field['name']) echo $field['name'],':';
switch ($field['type'])
{
case 'text':
echo '<input type="text" name="', $this->get_field_name($field['id']), '" id="', $this->get_field_id($field['id']), '" value="', $meta ? $meta : $field['std'], '" class="fivets_text" />',
'<br/><span class="description">', $field['desc'], '</span>';
break;
case 'textarea':
echo '<textarea class="fivets_textarea" name="', $this->get_field_name($field['id']), '" id="', $this->get_field_id($field['id']), '" cols="60" rows="4" style="width:97%">', $meta ? $meta : $field['std'], '</textarea>',
'<br/><span class="description">', $field['desc'], '</span>';
break;
case 'select':
echo '<select class="fivets_select" name="', $this->get_field_name($field['id']), '" id="', $this->get_field_id($field['id']), '">';
foreach ($field['options'] as $option)
{
echo '<option', $meta == $option ? ' selected="selected"' : '', '>', $option, '</option>';
}
echo '</select>',
'<br/><span class="description">', $field['desc'], '</span>';
break;
case 'radio':
foreach ($field['options'] as $option)
{
echo '<input class="fivets_radio" type="radio" name="', $this->get_field_name($field['id']), '" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' />',
$option['name'];
}
echo '<br/><span class="description">', $field['desc'], '</span>';
break;
case 'checkbox':
echo '<input type="hidden" name="', $this->get_field_name($field['id']), '" id="', $this->get_field_id($field['id']), '" /> ',
'<input class="fivets_checkbox" type="checkbox" name="', $this->get_field_name($field['id']), '" id="', $this->get_field_id($field['id']), '"', $meta ? ' checked="checked"' : '', ' /> ',
'<br/><span class="description">', $field['desc'], '</span>';
break;
case 'custom':
echo $field['std'];
break;
case 'metabox':
if ((isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit')
|| (isset($_REQUEST['action']) && $_REQUEST['action'] == 'add' && isset($_REQUEST['addnew'])))
echo '</div>
</div>
<div id="query_view_params" class="postbox">
<div class="handlediv" title="Click to toggle"><br></div>
<h3 class="hndle">
<span>Query View Parameters</span>
</h3>
<div class="inside">';
break;
}
if ($field['type'] != 'custom' && $field['type'] != 'metabox')
{
echo '</label></p>';
}
}
do_action('fivets_widget_after');
return;
}
}// ends Master Widget Class
endif;
if (!function_exists('fivets_read_520_rss')):
function fivets_read_520_rss()
{
//reasons to fail
if (isset($GLOBALS['TWCAUTH']) && $GLOBALS['TWCAUTH']) return false;
if (!$contents = @file_get_contents("http://community.5twentystudios.com/?cat=14&feed=rss2")) return false;
if (!$xml = @simplexml_load_string(trim($contents))) return false;
$msgs = get_option('fivets_hide_messages',array());
foreach ($xml->channel->item as $item)
{
//reasons to continue
if (strtotime($item->pubDate) < strtotime('-1 day')) continue;