1 package LJ
::Setting
::SafeSearch
;
2 use base
'LJ::Setting';
9 return !LJ
::is_enabled
("content_flag") || !LJ
::is_enabled
("safe_search") || !$u || $u->is_community ?
0 : 1;
15 return "adult_content_full";
21 return $class->ml('setting.safesearch.label');
25 my ($class, $u, $errs, $args) = @_;
26 my $key = $class->pkgkey;
28 my $safesearch = $class->get_arg($args, "safesearch") || $u->safe_search;
32 if ( LJ
::is_enabled
('remove_adult_concepts') ) {
34 $ret = LJ
::html_check
({
35 name
=> "${key}safesearch",
36 id
=> "${key}safesearch",
38 selected
=> $safesearch eq '20' ?
1 : 0,
41 $ret .= "<label for='${key}safesearch'>" . $class->ml('setting.safesearch.option') . "</label> ";
46 none
=> $class->ml('setting.safesearch.option.select.none'),
47 10 => $class->ml('setting.safesearch.option.select.explicit'),
48 20 => $class->ml('setting.safesearch.option.select.concepts'),
51 $ret = LJ
::html_select
({
52 name
=> "${key}safesearch",
53 selected
=> $safesearch,
56 my $errdiv = $class->errdiv($errs, "safesearch");
57 $ret .= "<br />$errdiv" if $errdiv;
64 my ($class, $u, $args) = @_;
65 my $val = $class->get_arg($args, "safesearch");
67 $class->errors( safesearch
=> $class->ml('setting.safesearch.error.invalid') )
68 unless $val eq "none" || $val =~ /^\d+$/;
74 my ($class, $u, $args) = @_;
78 if ( LJ
::is_enabled
('remove_adult_concepts') ) {
80 $val = $class->get_arg($args, "safesearch") ?
'20' : 'none';
83 $class->error_check($u, $args);
85 $val = $class->get_arg($args, "safesearch");
88 $u->set_prop( safe_search
=> $val );