array("min_range"=>1, "max_range"=>999)))); } else $int_ok = (is_numeric($_POST["rows_per_page"]) ? $_POST["rows_per_page"] : false); if ($int_ok) { $amain['rows_per_page'] = $int_ok; return (true); } else { $amain['rows_per_page'] = 25; } } } if (!function_exists('amrmeta_validate_avatar_size') ) { function amrmeta_validate_avatar_size() { /* basically the number of lists & names */ global $aopt; global $amain; if (function_exists( 'filter_var') ) { $int_ok = (filter_var($_POST["avatar_size"], FILTER_VALIDATE_INT, array("options" => array("min_range"=>1, "max_range"=>400)))); } else $int_ok = (is_numeric($_POST["avatar_size"]) ? $_POST["avatar_size"] : false); if ($int_ok) { $amain['avatar_size'] = $int_ok; return (true); } else { return (__('Invalid avatar size','amr-users')); } } } function amrmeta_validate_mainoptions() { global $amain; global $aopt; if (!empty($_POST["use_wp_query"]) ) { $amain['use_wp_query'] = true; } else $amain['use_wp_query'] = false; if (isset($_POST["do_not_use_css"]) ) { $amain['do_not_use_css'] = true; } else $amain['do_not_use_css'] = false; if (isset($_POST['use_css_on_pages']) ) { $check = explode(',',$_POST['use_css_on_pages']); foreach ($check as $i => $value) { $check[$i] = intval($value); } $amain['use_css_on_pages'] = implode(',',$check); } else $amain['use_css_on_pages'] = ''; if (isset($_POST['csv_text'])) { $return = amrmeta_validate_text('csv_text'); if ( is_wp_error($return) ) echo $return->get_error_message(); } if (isset($_POST['refresh_text'])) { $return = amrmeta_validate_text('refresh_text'); if ( is_wp_error($return) ) echo $return->get_error_message(); } if (isset($_POST["rows_per_page"]) ) { $return = amrmeta_validate_rows_per_page(); if ( is_wp_error($return) ) echo '

'.$return->get_error_message().'

'; } if (isset($_POST["avatar_size"]) ) { $return = amrmeta_validate_avatar_size(); if ( is_wp_error($return) ) echo '

'.$return->get_error_message().'

'; } $amain['version'] = AUSERS_VERSION; if (isset($_POST)) { ausers_update_option ('amr-users-main', $amain) ; //ausers_update_option ('amr-users', $aopt); } return; } function amr_meta_reset() { global $aopt; global $amain; global $amr_nicenames, $ausersadminurl; if ( amr_is_network_admin()) echo '

'.__('Deleting network versions of options: ','amr-users').'

'; if (ausers_delete_option ('amr-users')) echo '

'.__('Deleting number of lists and names in database','amr-users').'

'; // else echo '

'.__('Error deleting number of lists and names in database.','amr-users').'

'; if (ausers_delete_option ('amr-users-main')) echo '

'.__('Deleting all main settings in database','amr-users').'

'; // else echo '

'.__('Error deleting all lists settings in database','amr-users').'

'; if (ausers_delete_option ('amr-users-nicenames')) echo '

'.__('Deleting all nice name settings in database','amr-users').'

'; if (ausers_delete_option ('amr-users-nicenames-excluded')) echo '

'.__('Deleting all nice name exclusion settings in database','amr-users').'

'; if (ausers_delete_option ('amr-users-show-in-wplist')) echo '

'.__('Deleting the show in wp list settings','amr-users').'

'; // else echo '

'.__('Error deleting all lists settings in database','amr-users').'

'; if (ausers_delete_option ('amr-users-cache-status')) echo '

'.__('Deleting cache status in database','amr-users').'

'; if (ausers_delete_option ('amr-users-original-keys')) echo '

'.__('Deleting original keys mapping in database','amr-users').'

'; if (ausers_delete_option ('amr-users-excluded-meta-keys')) echo '

'.__('Deleting excluded meta keys setting in database','amr-users').'

'; if (ausers_delete_option ('amr-users-custom-headings')) echo '

'.__('Deleting custom-headings in database','amr-users').'

'; if (ausers_delete_option ('amr-users-filtering')) echo '

'.__('Deleting amr-users-filtering in database','amr-users').'

'; if (ausers_delete_option ('amr-users-prefixes-in-use')) echo '

'.__('Deleting amr-users-prefixes-in-use in database','amr-users').'

'; if (ausers_delete_option ('amr-users-field-types')) echo '

'.__('Deleting amr-users-field-types in database','amr-users').'

'; $c = new adb_cache(); //$c->clear_all_cache(); $c->deactivate(); echo '

'.__('All cached listings cleared.','amr-users').'

'; unset ($aopt); unset ($amain); unset ($amr_nicenames); echo '

' .__('Click to find your user fields again.','amr-users') .'

'; die; } function amr_meta_general_page_display() { global $amain; if (empty($amain)) $amain = ausers_get_option('amr-users-main'); if (empty($amain['csv_text'])) $amain['csv_text'] = ''.__('Csv','amr-users') .''; if (empty($amain['refresh_text'])) $amain['refresh_text'] = ''.__('Refresh user list cache','amr-users') .'' ; if (empty($amain['noaccess_text'])) $amain['noaccess_text'] = __('You do not have access to this list, or are not logged in.', 'amr-users'); if (!(isset ($amain['checkedpublic']))) { echo ''; } if (isset ($amain['do_not_use_css']) and ($amain['do_not_use_css'])) $do_not_use_css = ' checked="checked" '; else $do_not_use_css = ''; echo PHP_EOL.'
'; amr_users_say_thanks_opportunity_form(); echo '
'; echo '

'; _e('How to fetch data?','amr-users'); echo '

'; _e('Fetch user data with wp_query?   ', 'amr-users'); echo ' ';_e('WordPress does some extra work which requires more memory','amr-users');echo ''; echo '
'; // echo ''; // echo ''; echo '

'.__('General & Styling', 'amr-users').'

'; echo ' '; echo ' '; _e('Do not use css provided, my theme css is good enough', 'amr-users'); echo ''; echo '

'; if (!empty($amain['do_not_use_css'])) { $disabled = ' disabled="disabled" '; } else { $disabled = ''; } echo '


'; echo PHP_EOL. '
'.PHP_EOL. ''.' '.__('Preview:','amr-users').' '. ''. $amain['csv_text'].''; echo '

'.PHP_EOL. '
'.PHP_EOL. ''. ' '.__('Preview:','amr-users').' '. ''. $amain['refresh_text'].''; echo '

'.PHP_EOL. '
'; echo ''; echo '




'. ''.__('Info','amr-users').'' .'
'; echo ausers_submit(); echo '
'.PHP_EOL. '
' .PHP_EOL.'
'.PHP_EOL; } function amr_meta_general_page() { // may no longer be required 20170112 global $aopt; global $amr_nicenames; global $pluginpage; global $amain; $tabs['settings'] = __('General','amr-users'); //$tabs['overview'] = __('Overview & tools', 'amr-users'); if (isset($_GET['tab'])) { if ($_GET['tab'] == 'overview'){ //nlr amr_users_do_tabs ($tabs,'overview'); amr_meta_overview_page(); return; } else amr_users_do_tabs ($tabs,'settings'); } else amr_users_do_tabs ($tabs,'settings'); //amr_meta_main_admin_header('General'); amr_meta_admin_headings (); // does the nonce check etc if (isset ($_POST['action']) and ($_POST['action'] == "save")) { if (isset ($_POST['reset'])){ amr_meta_reset(); return; } else amrmeta_validate_mainoptions(); } amr_meta_general_page_display(); /* else do the main header page */ } function amr_meta_general() { // if called from about 20170111 amr_meta_admin_headings (); // does the nonce check etc if (isset ($_POST['action']) and ($_POST['action'] == "save")) { if (isset ($_POST['reset'])){ amr_meta_reset(); return; } else amrmeta_validate_mainoptions(); } amr_meta_general_page_display(); /* else do the main header page */ }