options = get_option(LBRY_SETTINGS);
require_once( LBRY_ABSPATH . 'templates/options-page.php' );
}
/**
* Sanitizes setting input
* // COMBAK Potentially sanitize more
*/
public function sanitize_general_settings( $input )
{
if (!empty($input[LBRY_SPEECH_CHANNEL])) {
$channel = $input[LBRY_SPEECH_CHANNEL];
$channel = str_replace('@', '', $channel);
$input[LBRY_SPEECH_CHANNEL] = $channel;
}
if (!empty($input[LBRY_SPEECH_PW])) {
$encrypted = $this->encrypt($input['lbry_speech_pw']);
$input[LBRY_SPEECH_PW] = $encrypted;
} else {
// If we have a password and its empty, keep orginal password
if (!empty(get_option(LBRY_SETTINGS)[LBRY_SPEECH_PW])) {
$input[LBRY_SPEECH_PW] = get_option(LBRY_SETTINGS)[LBRY_SPEECH_PW];
}
}
return $input;
}
public function sanitize_speech_settings( $input )
{
$new_input = get_option( LBRY_SPEECH_SETTINGS );
if ( isset( $input[LBRY_SPEECH] ) ) {
$new_input[LBRY_SPEECH] = sanitize_text_field( $input[LBRY_SPEECH] );
}
if ( isset( $input[LBRY_SPEECH_CHANNEL] ) ) {
$channel = $input[LBRY_SPEECH_CHANNEL];
$channel = str_replace( '@', '', $channel );
$new_input[LBRY_SPEECH_CHANNEL] = sanitize_user( $channel );
}
if ( isset( $input[LBRY_SPEECH_PW] ) ) {
$input[LBRY_SPEECH_PW] = sanitize_text_field( $input[LBRY_SPEECH_PW] );
$encrypted = $this->encrypt( $input[LBRY_SPEECH_PW] );
$new_input[LBRY_SPEECH_PW] = $encrypted;
} else {
// If we have a password and it's empty, keep original password
if ( empty( $input[LBRY_SPEECH_PW] ) )
$new_input[LBRY_SPEECH_PW] = get_option( LBRY_SPEECH_SETTINGS[LBRY_SPEECH_PW] );
}
return $new_input;
update_option( LBRY_SPEECH_SETTINGS, $new_input );
}
/**
* Section info for the General Section
*/
public function general_section_callback()
{
print 'This is where you can configure how LBRYPress will distribute your content:';
}
/**
* Section info for the Speech Channel Section
*/
public function speech_section_callback()
{
print 'If you have a Spee.ch account, you can enter your account details here, if you don\'t already have a Spee.ch account, no need to enter anything here.';
}
/**
* Section info for the Available Channel(s) Section
*/
public function available_channels_callback()
{
$channel_list = LBRY()->daemon->channel_list();
if ( $channel_list ) { ?>
name ) ?>
Looks like you haven't added any channels yet, feel free to do so below:
daemon->address_list();
$address = is_array($address) && !empty($address) ? $address[0]->address : '';
printf(
'',
LBRY_WALLET,
LBRY_SETTINGS,
$address
);
}
/**
* Prints License input
*/
public function license_callback()
{
// TODO: Maybe make this more elegant?
$options = '';
// Create options list, select current license
//
foreach (LBRY()->licenses as $value => $name) {
$selected = $this->options[LBRY_LICENSE] === $value;
$options .= '