-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.php
More file actions
1057 lines (880 loc) · 25.3 KB
/
plugin.php
File metadata and controls
1057 lines (880 loc) · 25.3 KB
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
/**
* User Profiles
*
* Plugin core class, do not namespace.
*
* @package User Profiles
* @subpackage Core
* @since 1.0.0
*/
// Stop if accessed directly.
if ( ! defined( 'BLUDIT' ) ) {
die( 'You are not allowed direct access to this file.' );
}
// Access namespaced functions.
use function UPRO_Func\{
theme_compat,
usernames,
profile_fields,
content_filter,
default_cover,
autop
};
use function UPRO_Tags\{
author_box
};
class User_Profiles extends Plugin {
/**
* Storage root
*
* @since 1.0.0
* @access public
* @var string
*/
public $storage_root = 'user-profiles';
/**
* Cache age
*
* @since 1.0.0
* @access private
* @var integer
*/
private $max_image_cache = 86400;
/**
* Constructor method
*
* @since 1.0.0
* @access public
* @return self
*/
public function __construct() {
// Run parent constructor.
parent :: __construct();
// Include functionality.
if ( $this->installed() ) {
$this->autoload();
$this->get_files();
}
}
/**
* Prepare plugin for installation
*
* @since 1.0.0
* @access public
* @return void
*/
public function prepare() {
$this->autoload();
$this->get_files();
}
/**
* Autoload classes
*
* @since 1.0.0
* @access public
* @return void
*/
public function autoload() {
// Path to class files.
$path = PATH_PLUGINS . 'user-profiles' . DS . 'includes/classes' . DS;
// Array of namespaced classes & filenames.
$classes = [
'UPRO_Classes\Image_Upload' => $path . 'class-image-upload.php',
'UPRO_Classes\Avatar_Images' => $path . 'class-avatar-images.php',
'UPRO_Classes\Avatar_Album' => $path . 'class-avatar-album.php',
'UPRO_Classes\Cover_Images' => $path . 'class-cover-images.php',
'UPRO_Classes\Cover_Album' => $path . 'class-cover-album.php',
'UPRO_Classes\Image_Album' => $path . 'class-image-album.php'
];
spl_autoload_register(
function ( string $class ) use ( $classes ) {
if ( isset( $classes[$class] ) ) {
require $classes[$class];
}
}
);
}
/**
* Include functionality
*
* @since 1.0.0
* @access public
* @return void
*/
public function get_files() {
// Plugin path.
$path = PATH_PLUGINS . $this->directoryName . DS;
// Get plugin functions.
foreach ( glob( $path . 'includes/*.php' ) as $filename ) {
require_once $filename;
}
}
/**
* Initiate plugin
*
* @since 1.0.0
* @access public
* @global object $L Language class.
* @return void
*/
public function init() {
// Access global variables.
global $L;
$this->get_files();
$dynamic_fields = profile_fields();
$static_fields = [
'author_display' => 'post',
'author_tabbed' => true,
'author_location' => 'after',
'author_avatar' => true,
'author_role' => true,
'author_email' => true,
'author_site' => true,
'author_social' => true,
'author_posts' => true,
'author_limit' => 5,
'users_slug' => 'users',
'avatar_width' => 320,
'avatar_height' => 320,
'default_avatar' => 'user',
'custom_avatar' => [],
'default_cover' => [],
'cover_thumb_width' => 320,
'cover_thumb_height' => 320,
'cover_thumb_quality' => 90,
'cover_large_width' => 1920,
'cover_large_height' => 1080,
'cover_large_quality' => 90,
'profile_pages' => false,
'header_style' => 'one',
'bio_avatar_radius' => 10,
'bio_heading' => '',
'details_heading' => $L->get( 'Details' ),
'profile_role' => true,
'profile_email' => true,
'profile_site' => true,
'profile_social' => true,
'profile_posts' => true,
'profile_limit' => 6,
'sidebar_bio' => false,
'sb_bio_display' => 'post',
'sb_bio_limit' => 200,
'widgets_label' => 'h2',
'sidebar_avatar' => true,
'sidebar_links' => true,
'sidebar_more' => true,
'more_widget_label' => '',
'sidebar_limit' => 5,
'sidebar_list' => true,
'sb_list_label' => $L->get( 'Authors' ),
'sb_list_avatar' => true,
'sb_list_display' => 'all',
'sb_list_role' => 'author',
'sb_list_limit' => 12,
'sb_list_select' => [ 'foobar' ],
'sb_widgets_sort' => 'posts,list'
];
$fields = array_merge( $dynamic_fields, $static_fields );
// Array of custom hooks.
$this->customHooks = [
'author_box',
'user_profile_before',
'user_profile_content',
'user_profile_after'
];
$this->dbFields = $fields;
if ( ! $this->installed() ) {
$Tmp = new dbJSON( $this->filenameDb );
$this->db = $Tmp->db;
$this->prepare();
}
}
/**
* Install plugin
*
* @since 1.0.0
* @access public
* @param integer $position
* @return boolean Return true if the installation is successful.
*/
public function install( $position = 100 ) {
// Create plugin directory for the database
mkdir( PATH_PLUGINS_DATABASES . $this->directoryName, DIR_PERMISSIONS, true );
$this->dbFields['position'] = $position;
// Sanitize default values to store in the file.
foreach ( $this->dbFields as $key => $value ) {
if ( is_array( $value ) ) {
$array_fields = [];
foreach ( $value as $array_field ) {
if ( is_int( $array_field ) ) {
$array_field = Sanitize :: int( $array_field );
} elseif ( is_string( $array_field ) ) {
$array_field = Sanitize :: html( $array_field );
}
$array_fields[] = $array_field;
}
$value = $array_fields;
} elseif ( is_int( $value ) ) {
$value = Sanitize :: int( $value );
} else {
$value = Sanitize :: html( $value );
}
settype( $value, gettype( $this->dbFields[$key] ) );
$this->db[$key] = $value;
}
$storage = PATH_CONTENT . $this->storage_root . DS;
if ( ! file_exists( $storage ) ) {
Filesystem :: mkdir( $storage, true );
}
file_put_contents( $storage . '.htaccess', 'Deny from all' );
// Create the database.
return $this->save();
}
/**
* Uninstall
*
* @since 1.0.0
* @access public
* @return boolean
*/
public function uninstall() {
// Delete database.
$path = PATH_PLUGINS_DATABASES . $this->directoryName;
Filesystem :: deleteRecursive( $path );
return true;
}
/**
* Form post
*
* The form `$_POST` method.
*
* Essentially the same as the parent method
* except that it allows for array field values.
*
* This was implemented to handle multi-checkbox
* and radio button fields. If strings are used
* in an array option then be sure to sanitize
* the string values.
*
* @since 1.0.0
* @access public
* @return void
*/
public function post() {
$args = $_POST;
foreach ( $this->dbFields as $field => $value ) {
if ( isset( $args[$field] ) ) {
// Array fields.
if ( is_array( $args[$field] ) ) {
$array_fields = [];
foreach ( $args[$field] as $array_field ) {
if ( is_int( $array_field ) ) {
$array_field = Sanitize :: int( $array_field );
} elseif ( is_string( $array_field ) ) {
$array_field = Sanitize :: html( $array_field );
}
$array_fields[] = $array_field;
}
$value = $array_fields;
// Integer fields.
} elseif ( is_int( $args[$field] ) ) {
$value = Sanitize :: int( $args[$field] );
// String fields.
} else {
$value = Sanitize :: html( $args[$field] );
}
// Convert true/false strings to boolean.
if ( 'false' === $value ) {
$value = false;
} elseif ( 'true' === $value ) {
$value = true;
}
settype( $value, gettype( $value ) );
$this->db[$field] = $value;
}
}
if ( empty( $this->getValue( 'users_slug' ) ) ) {
$this->setField( 'users_slug', 'users' );
}
return $this->save();
}
/**
* Admin settings form
*
* @since 1.0.0
* @access public
* @global object $L Language class.
* @global object $site Site class.
* @return string Returns the markup of the form.
*/
public function form() {
// Access global variables.
global $L, $site;
global $layout;
$layout['title'] = $L->get( 'User Profiles Guide' ) . ' | ' . $site->title();
$avatar = 'avatar';
$cover = 'cover';
$config['imagesSort'] = 'newest';
$avatars = new UPRO_Classes\Avatar_Album( $config, true );
$covers = new UPRO_Classes\Cover_Album( $config, true );
$html = '';
// ob_start();
include( $this->phpPath() . '/views/page-form.php' );
// $html .= ob_get_clean();
return $html;
}
/**
* Admin controller
*
* Change the text of the `<title>` tag.
*
* @since 1.0.0
* @access public
* @global object $L The Language class.
* @global array $layout
* @return string Returns the head content.
*/
public function adminController() {
global $L, $layout, $site;
$layout['title'] = $L->get( 'User Profiles Guide' ) . ' | ' . $site->title();
}
/**
* Admin scripts & styles
*
* @since 1.0.0
* @access public
* @global object $url Url class.
* @return string Returns the head content.
*/
public function adminHead() {
// Access global variables.
global $url;
// Maybe get non-minified assets.
$suffix = '.min';
if ( defined( 'DEBUG_MODE' ) && DEBUG_MODE ) {
$suffix = '';
}
$assets = '';
// Load only for this plugin's pages.
if ( str_contains( $url->slug(), $this->className() ) ) :
$assets .= "\n";
$assets .= '<script type="text/javascript" src="' . $this->domainPath() . "assets/js/dropzone{$suffix}.js?version=" . $this->getMetadata( 'version' ) . '"></script>' . PHP_EOL;
$assets .= '<script type="text/javascript" src="' . $this->domainPath() . "assets/js/tabs{$suffix}.js?version=" . $this->getMetadata( 'version' ) . '"></script>' . PHP_EOL;
$assets .= '<script type="text/javascript" src="' . $this->domainPath() . "assets/js/tooltips{$suffix}.js?version=" . $this->getMetadata( 'version' ) . '"></script>' . PHP_EOL;
$assets .= '<script type="text/javascript" src="' . $this->domainPath() . "assets/js/lightbox{$suffix}.js?version=" . $this->getMetadata( 'version' ) . '"></script>' . PHP_EOL;
$assets .= '<script type="text/javascript" src="' . $this->domainPath() . "assets/js/backend{$suffix}.js?version=" . $this->getMetadata( 'version' ) . '"></script>' . PHP_EOL;
$assets .= '<link rel="stylesheet" type="text/css" href="' . $this->domainPath() . "assets/css/dropzone.min.css?version=" . $this->getMetadata( 'version' ) . '" />' . PHP_EOL;
$assets .= '<link rel="stylesheet" type="text/css" href="' . $this->domainPath() . "assets/css/tooltips{$suffix}.css?version=" . $this->getMetadata( 'version' ) . '" />' . PHP_EOL;
$assets .= '<link rel="stylesheet" type="text/css" href="' . $this->domainPath() . "assets/css/lightbox{$suffix}.css?version=" . $this->getMetadata( 'version' ) . '" />' . PHP_EOL;
$assets .= '<link rel="stylesheet" type="text/css" href="' . $this->domainPath() . "assets/css/backend{$suffix}.css?version=" . $this->getMetadata( 'version' ) . '" />' . PHP_EOL;
$assets .= '<style>';
$assets .= ':root { --upro-profile--avatar--border-radius: ' . $this->bio_avatar_radius() . ' }';
$assets .= '</style>';
endif;
return $assets;
}
/**
* Admin info pages
*
* @since 1.0.0
* @access public
* @global object $L Language class.
* @global object $site Site class.
* @return string Returns the markup of the page.
*/
public function adminView() {
// Access global variables.
global $L, $site;
$html = '';
ob_start();
include( $this->phpPath() . '/views/page-guide.php' );
$html .= ob_get_clean();
return $html;
}
/**
* Sidebar link
*
* Link to the options screen in the admin sidebar menu.
*
* @since 1.0.0
* @access public
* @global object $L Language class.
* @global object $site Site class.
* @return mixed
*/
public function adminSidebar() {
// Access global variables.
global $L, $site;
// Check user role.
if ( ! checkRole( [ 'admin' ], false ) ) {
return;
}
$form = HTML_PATH_ADMIN_ROOT . 'configure-plugin/' . $this->className();
$html = sprintf(
'<a class="nav-link" href="%s"><span class="fa fa-users"></span>%s</a>',
$form,
$L->get( 'User Profiles' )
);
return $html;
}
/**
* Admin body end
*
* Used for adding scripts.
*
* @since 1.0.0
* @access public
* @global object $L Language class.
* @global object $site Site class.
* @global object $url Url class.
* @return string
*/
public function adminBodyEnd() {
// Access global variables.
global $L, $page, $site, $url;
$html = '';
// Settings page URL.
$settings_page = DOMAIN_ADMIN . 'configure-plugin/' . $this->className() . '#options';
if ( checkRole( [ 'admin' ], false ) && str_contains( $url->slug(), 'edit-user' ) ) {
return sprintf(
'<script>var uuid = $("#jsuuid").val(); $uuid = uuid; if ( $uuid != "" ) { $( "#jsform nav" ).prepend( "<div class=\'alert alert-primary alert-search-forms\' role=\'alert\'><p class=\'m-0\'><a href=\'%s\'>%s</a></p></div>"); }</script>',
$settings_page,
$L->get( 'Edit advanced user options' )
);
}
if ( checkRole( [ 'admin' ], false ) && 'users' == $url->slug() ) {
return sprintf(
'<script>var uuid = $("#jsuuid").val(); $uuid = uuid; if ( $uuid != "" ) { $( "h1 + a" ).append( "<div class=\'alert alert-primary alert-search-forms\' role=\'alert\'><p class=\'m-0\'><a href=\'%s\'>%s</a></p></div>"); }</script>',
$settings_page,
$L->get( 'Edit advanced user options' )
);
}
// Load only for this plugin's settings page.
if ( str_contains( $url->slug(), $this->className() ) ) :
// AJAX paths for uploads.
$upload_path = HTML_PATH_ADMIN_ROOT . 'user-profiles';
$current_path = strtok( $_SERVER['REQUEST_URI'], '?' );
if ( $current_path == $upload_path ) {
// Fetch content.
$content = ob_get_contents();
ob_end_clean();
$avatar = 'avatar';
$cover = 'cover';
$domain = $this->domainPath();
// Get helper objects.
require_once( 'includes/classes/class-avatar-images-helper.php' );
require_once( 'includes/classes/class-cover-images-helper.php' );
$avatar_helper = new \UPRO_Classes\Avatar_Images_Helper();
$cover_helper = new \UPRO_Classes\Cover_Images_Helper();
// Load required JS.
$html .= '<script type="text/javascript" src="' . $this->domainPath() . "assets/js/jquery-confirm.min.js?version=" . $this->getMetadata( 'version' ) . '"></script>' . PHP_EOL;
$html .= $avatar_helper->adminJSData( $domain );
$html .= $cover_helper->adminJSData( $domain );
if ( $avatar ) {
$html .= $avatar_helper->dropzoneJSData( $avatar );
}
if ( $cover ) {
$html .= $cover_helper->dropzoneJSData( $cover );
}
// Remove old admin content (error message)
$regexp = "#(\<div class=\"col-lg-10 pt-3 pb-1 h-100\"\>)(.*?)(\<\/div\>)#s";
$content = preg_replace( $regexp, "$1{$html}$3", $content );
echo $content;
return;
}
$avatar = 'avatar';
$cover = 'cover';
$domain = $this->domainPath();
// Get helper objects.
require_once( 'includes/classes/class-avatar-images-helper.php' );
require_once( 'includes/classes/class-cover-images-helper.php' );
$avatar_helper = new \UPRO_Classes\Avatar_Images_Helper();
$cover_helper = new \UPRO_Classes\Cover_Images_Helper();
// Load required JS
$html .= '<script type="text/javascript" src="' . $this->domainPath() . "assets/js/jquery-confirm.min.js?version=" . $this->getMetadata( 'version' ) . '"></script>' . PHP_EOL;
$html .= $avatar_helper->adminJSData( $domain );
$html .= $cover_helper->adminJSData( $domain );
if ( $avatar ) {
$html .= $avatar_helper->dropzoneJSData( $avatar );
}
if ( $cover ) {
$html .= $cover_helper->dropzoneJSData( $cover );
}
endif;
return $html;
}
/**
* Before all hook
*
* @since 1.0.0
* @access public
* @global object $url Url class.
* @return void
*/
public function beforeAll() {
// Access global variables.
global $url;
// Check if the URL matches the webhook.
$webhook = $this->users_slug();
if ( $this->webhook( $webhook, true, false ) ) {
$url->setWhereAmI( $webhook );
}
}
/**
* Before site load
*
* Runs on the front end before content is printed.
* Content is or is not modified according to plugin
* options and page type.
*
* @since 1.0.0
* @access public
* @global array $content Available content.
* @return void
*/
public function beforeSiteLoad() {
// Access global variables.
global $content;
$webhook = $this->users_slug();
if ( $this->webhook( $webhook, true, false ) ) {
$content = [];
$list = usernames();
foreach ( $list as $name ) {
array_push( $content, $name );
}
}
// Filter page content to add profile.
content_filter();
}
/**
* Author box hook
*
* Plugin hook for custom theme location.
*
* @since 1.0.0
* @access public
* @return boolean
*/
public function author_box() {
if ( 'author_box' == $this->author_location() ) {
echo author_box();
}
return false;
}
/**
* Head section
*
* @since 1.0.0
* @access public
* @global object $url Url class.
* @return string Returns the head content.
*/
public function siteHead() {
// Access global variables.
global $url;
// Maybe get non-minified assets.
$suffix = '.min';
if ( defined( 'DEBUG_MODE' ) && DEBUG_MODE ) {
$suffix = '';
}
$assets = '';
$assets .= '<script type="text/javascript" src="' . $this->domainPath() . "assets/js/frontend{$suffix}.js?version=" . $this->getMetadata( 'version' ) . '"></script>' . PHP_EOL;
$assets .= '<script type="text/javascript" src="' . $this->domainPath() . "assets/js/tabs{$suffix}.js?version=" . $this->getMetadata( 'version' ) . '"></script>' . PHP_EOL;
$assets .= '<link rel="stylesheet" type="text/css" href="' . $this->domainPath() . "assets/css/frontend{$suffix}.css?version=" . $this->getMetadata( 'version' ) . '" />' . PHP_EOL;
$assets .= '<style>';
$assets .= ':root { --upro-profile--avatar--border-radius: ' . $this->bio_avatar_radius() . ' }';
$assets .= '</style>';
return $assets;
}
/**
* Sidebar content
*
* @since 1.0.0
* @access public
* @global object $L Language class.
* @global object $site Site class.
* @global object $url Url class.
* @return string Returns the sidebar markup.
*/
public function siteSidebar() {
// Access global variables.
global $L, $site, $url;
$users_slug = $this->users_slug();
$html = '';
ob_start();
include( $this->phpPath() . '/views/site-sidebar.php' );
$html .= ob_get_clean();
return $html;
}
/**
* User page content
*
* Content for the singular user page.
* Requires that the theme employ the
* `user_profile_content` hook.
*
* @since 1.0.0
* @access public
* @return mixed Returns the content markup or false.
*/
public function user_profile_content() {
$html = '';
include( $this->phpPath() . '/views/profile.php' );
$html .= ob_get_clean();
return $html;
}
/**
* Option return functions
*
* @since 1.0.0
* @access public
*/
// @return string
public function author_display() {
return $this->getValue( 'author_display' );
}
// @return string
public function author_location() {
return $this->getValue( 'author_location' );
}
// @return boolean
public function author_tabbed() {
return $this->getValue( 'author_tabbed' );
}
// @return boolean
public function author_avatar() {
return $this->getValue( 'author_avatar' );
}
// @return boolean
public function author_role() {
return $this->getValue( 'author_role' );
}
// @return boolean
public function author_email() {
return $this->getValue( 'author_email' );
}
// @return boolean
public function author_site() {
return $this->getValue( 'author_site' );
}
// @return boolean
public function author_social() {
return $this->getValue( 'author_social' );
}
// @return boolean
public function author_posts() {
return $this->getValue( 'author_posts' );
}
// @return integer
public function author_limit() {
return $this->getValue( 'author_limit' );
}
// @return string
public function users_slug() {
$field = $this->getValue( 'users_slug' );
$decode = htmlspecialchars_decode( $field );
$strip = strip_tags( $decode );
$replace = str_replace( [ '_', '.', '/', ' ' ], '-', $strip );
$slug = mb_strtolower( $replace, CHARSET );
return $slug;
}
// @return integer
public function avatar_width() {
return $this->getValue( 'avatar_width' );
}
// @return integer
public function avatar_height() {
return $this->getValue( 'avatar_height' );
}
// @return string
public function default_avatar() {
return $this->getValue( 'default_avatar' );
}
// @return array
public function custom_avatar() {
return $this->getValue( 'custom_avatar' );
}
// @return array
public function default_cover() {
return $this->getValue( 'default_cover' );
}
// @return boolean
public function profile_pages() {
return $this->getValue( 'profile_pages' );
}
// @return string
public function header_style() {
return $this->getValue( 'header_style' );
}
// @return integer
public function bio_avatar_radius() {
return $this->getValue( 'bio_avatar_radius' ) . '%';
}
// @return string
public function bio_heading() {
return $this->getValue( 'bio_heading' );
}
// @return string
public function details_heading() {
return $this->getValue( 'details_heading' );
}
// @return boolean
public function profile_role() {
return $this->getValue( 'profile_role' );
}
// @return boolean
public function profile_email() {
return $this->getValue( 'profile_email' );
}
// @return boolean
public function profile_site() {
return $this->getValue( 'profile_site' );
}
// @return boolean
public function profile_social() {
return $this->getValue( 'profile_social' );
}
// @return boolean
public function profile_posts() {
return $this->getValue( 'profile_posts' );
}
// @return integer
public function profile_limit() {
return $this->getValue( 'profile_limit' );
}
// @return boolean
public function sidebar_bio() {
return $this->getValue( 'sidebar_bio' );
}
// @return string
public function sb_bio_display() {
return $this->getValue( 'sb_bio_display' );
}
// @return integer
public function sb_bio_limit() {
return $this->getValue( 'sb_bio_limit' );
}
// @return string
public function widgets_label() {
return $this->getValue( 'widgets_label' );
}
// @return boolean
public function sidebar_avatar() {
return $this->getValue( 'sidebar_avatar' );
}
// @return boolean
public function sidebar_links() {
return $this->getValue( 'sidebar_links' );
}
// @return boolean
public function sidebar_more() {
return $this->getValue( 'sidebar_more' );
}
// @return string
public function more_widget_label() {
return $this->getValue( 'more_widget_label' );
}
// @return integer
public function sidebar_limit() {
return $this->getValue( 'sidebar_limit' );
}
// @return boolean
public function sidebar_list() {
return $this->getValue( 'sidebar_list' );
}
// @return string
public function sb_list_label() {
if ( ! empty( $this->getValue( 'sb_list_label' ) ) ) {
return ucwords( $this->getValue( 'sb_list_label' ) );
} else {
return $this->dbFields['sb_list_label'];
}
}
// @return boolean
public function sb_list_avatar() {
return $this->getValue( 'sb_list_avatar' );
}
// @return string
public function sb_list_display() {
return $this->getValue( 'sb_list_display' );
}
// @return string
public function sb_list_role() {
return $this->getValue( 'sb_list_role' );
}
// @return integer
public function sb_list_limit() {
return $this->getValue( 'sb_list_limit' );
}
// @return array
public function sb_list_select() {
$select = $this->getValue( 'sb_list_select' );
$filtered = [];
foreach ( $select as $user ) {
if ( 'foobar' == $user ) {
continue;
}
$filtered[] = $user;
}
return $filtered;
}
// @return array
public function sb_widgets_sort() {
return $this->getValue( 'sb_widgets_sort' );
}
/**
* Random cover image
*
* Get one random image from the array of selected
* cover image uploads. If only one is selected then
* the default cover will always be the same image.