0 ) { foreach ( self::$errors as $error ) { echo '
' . esc_html( $error ) . '
' . esc_html( $message ) . '
You can only view 10 searches per table. Please upgrade to the premium version to view and download all searches.
| Query | Searches | Results | $single->modified | "; echo "$single->searches | "; echo "$single->hits | "; } ?>
|---|
' . $tooltip_html . '
'; } return array( 'description' => $description, 'tooltip_html' => $tooltip_html ); } /** * Save admin fields. * * * @param array $options * @return bool */ public static function save_fields( $options ) { if ( empty( $_POST ) ) { return false; } // Options to update will be stored here and saved later $update_options = array(); // Loop options and get values to save foreach ( $options as $option ) { if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { continue; } // Get posted value if ( strstr( $option['id'], '[' ) ) { parse_str( $option['id'], $option_name_array ); $option_name = current( array_keys( $option_name_array ) ); $setting_name = key( $option_name_array[ $option_name ] ); $raw_value = isset( $_POST[ $option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $option_name ][ $setting_name ] ) : null; } else { $option_name = $option['id']; $setting_name = ''; $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; } // Format the value based on option type switch ( $option['type'] ) { case 'checkbox' : $value = is_null( $raw_value ) ? 'no' : 'yes'; break; case 'textarea' : $value = wp_kses_post( trim( $raw_value ) ); break; case 'multiselect' : case 'multi_select_countries' : $value = array_filter( array_map( 'als_clean', (array) $raw_value ) ); break; case 'image_width' : $value = array(); if ( isset( $raw_value['width'] ) ) { $value['width'] = als_clean( $raw_value['width'] ); $value['height'] = als_clean( $raw_value['height'] ); $value['crop'] = isset( $raw_value['crop'] ) ? 1 : 0; } else { $value['width'] = $option['default']['width']; $value['height'] = $option['default']['height']; $value['crop'] = $option['default']['crop']; } break; default : $value = als_clean( $raw_value ); break; } /** * Sanitize the value of an option. */ $value = apply_filters( 'als_admin_settings_sanitize_option', $value, $option, $raw_value ); /** * Sanitize the value of an option by option name. */ $value = apply_filters( "als_admin_settings_sanitize_option_$option_name", $value, $option, $raw_value ); if ( is_null( $value ) ) { continue; } // Check if option is an array and handle that differently to single values. if ( $option_name && $setting_name ) { if ( ! isset( $update_options[ $option_name ] ) ) { $update_options[ $option_name ] = get_option( $option_name, array() ); } if ( ! is_array( $update_options[ $option_name ] ) ) { $update_options[ $option_name ] = array(); } $update_options[ $option_name ][ $setting_name ] = $value; } else { $update_options[ $option_name ] = $value; } } // Save all options in our array foreach ( $update_options as $name => $value ) { update_option( $name, $value ); } return true; } } add_action( 'admin_menu', 'Als_Admin_Settings::add_menu_page' );