* @copyright 2016 audior.ec
* @license This WordPress Plugin is distributed under the terms of the GNU General Public License V2.0.
* you can redistribute it and/or modify it under the terms of the GNU General Public License V2.0
* as published by the Free Software Foundation, either version 3 of the License, or any later version.
* You should have received a copy of the GNU General Public License along with this plugin. If not, see .
* @link http://audior.ec
* @version 1.0.2
*/
global $wp_roles;
global $wpdb;
$user_roles = array();
foreach($wp_roles->roles as $role => $details){
$user_roles[$role] = $details["name"];
}
$user_roles['visitors'] = "Visitors";
if (is_multisite()){
$user_roles['networkuser'] = "Network user";
}
$location = get_option('siteurl') . '/wp-admin/admin.php?page=audio-comments/audior-settings.php';
$settingsTable = $wpdb->prefix . "audior_settings";
$permissionsTable = $wpdb->prefix . "audior_permissions";
$generalSettingsInputs = array(
'license_key' => array(
'label' => 'License key',
'type' => 'text',
),
'file_name_prefix' => array(
'label' => 'File name prefix',
'type' => 'small-text',
),
'show_sound_wave' => array(
'label' => 'Show sound wave',
'type' => 'select',
'values' => array('1'=>'Yes', '0'=>'No'),
),
'marker_distance' => array(
'label' => 'Marker distance',
'type' => 'small-text',
),
'language_file' => array(
'label' => 'Language file',
'type' => 'small-text',
),
'disable_record_again_button' => array(
'label' => 'Disable record again button',
'type' => 'select',
'values' => array('1'=>'Yes', '0'=>'No'),
),
);
$designSettingsInputs = array(
'bg_corner_radius' => array(
'label' => 'Corner radius',
'type' => 'small-text',
),
'bg_color' => array(
'label' => 'Background color',
'type' => 'small-text',
),
'border_color' => array(
'label' => 'Border color',
'type' => 'small-text',
),
'border_width' => array(
'label' => 'Border width',
'type' => 'small-text',
),
'sound_wave_color' => array(
'label' => 'Sound wave color',
'type' => 'small-text',
),
'play_back_fill_color' => array(
'label' => 'Play back fill color',
'type' => 'small-text',
),
);
$permissionsInputs = array(
'enable_audior' => array(
'label' => 'Enable Audior Comments',
'type' => 'checkbox',
),
'time_limit' => array(
'label' => 'Max time limit',
'type' => 'small-text',
),
);
if (isset($_POST['audior-setting-submit'])) {
$data = array();
foreach ($generalSettingsInputs as $key=>$value) {
$data[$key] = trim($_POST['general_setting_' . $key]);
}
foreach ($designSettingsInputs as $key=>$value) {
$data[$key] = trim($_POST['design_setting_' . $key]);
}
$wpdb->update($settingsTable, $data, array('id'=>'1'));
foreach ($user_roles as $user_role => $name) {
$dataPermissions = array();
foreach ($permissionsInputs as $key=>$value) {
$dataPermissions[$key] = trim($_POST[$user_role . '_permissions_' . $key]);
}
$wpdb->update($permissionsTable, $dataPermissions, array('user_role'=>$user_role));
}
}
$generalSettings = $wpdb->get_results( "SELECT * FROM ".$settingsTable . " LIMIT 1 ");
?>
Audio Comments