0 ) { foreach ( self::$errors as $error ) { echo '

' . esc_html( $error ) . '

'; } } elseif ( sizeof( self::$messages ) > 0 ) { foreach ( self::$messages as $message ) { echo '

' . esc_html( $message ) . '

'; } } } /** * Add an admin page */ public static function add_menu_page( ) { add_menu_page( 'Ajax Live Search Lite', 'Ajax Live Search Lite', 'manage_options', 'als-admin-page', 'Als_Admin_Settings::show_upgrade_page', false, '2'); add_submenu_page( 'als-admin-page', 'Search Statistics', 'Statistics', 'manage_options', 'als-statistics', 'Als_Admin_Settings::show_statistics_page' ); add_submenu_page( 'als-admin-page', 'Als Settings', 'Settings', 'manage_options', 'als-settings', 'Als_Admin_Settings::output' ); add_submenu_page( 'als-admin-page', 'Search Index', 'Search Index', 'manage_options', 'als-index', 'Als_Admin_Settings::show_index_page' ); } /** * Displays the main als admin page * */ public static function show_upgrade_page() {?>

Thank you for downloading Ajax Live Search; One of the best searching plugins out there. Please feel free to email us if you wanna chat or have any feature request. We also have an extensive documentation in case you encounter any problems when using this plugin.

Due to lack of enough human resources, we currently don't offer email/ticket support to our users of the lite version of this plugin. However, you can upgrade to the pro version and get access to one on one support together with the following extra features;

  1. Caching of search results which in turn increases perfomance by over 300%. Unlike other caching plartforms, the cache is only updated once a new post is added to the index or updated, hence less database load.
  2. Option to load suggestions from Google or YouTube api hence reducing server load.
  3. An intelligent system that displays matching authors etc; to the search results there by offering better user experince.
  4. Show sponsored results at the top of search results by providing us with your affiliate links. This increases affiliate clickthroughs since the sponsored results are closely related to the search queries.
  5. Ability to save search statistics in csv format so that you can analyse them from your favourite speadsheet program.
  6. Access to graphical statistics for better analysis of search data.
  7. A better ranking system that makes use of markov chains, ngrams and inverse document frequencies to achieve app. 90% relevancy ranking.
  8. Many more features

Upgrade Now For $19 Only!

().

().

( 0')?>)

0','searches DESC' ); ?>

0','hits DESC' ); ?>

0','hits ASC' ); ?>
'; $title = __('A list of all indexed posts.', 'als-lite'); echo "

$title

";?> prefix . "als_index"; $sql = "SELECT DISTINCT(post_id) FROM $index_table"; $results = $wpdb->get_results($sql); $ids = array(); foreach ($results as $single) { $ids[] = intval($single->post_id); } $ids = implode(',', $ids); $sql = "SELECT ID, post_title FROM $wpdb->posts WHERE ID in($ids) ORDER BY post_title"; $results = $wpdb->get_results($sql); for ($i = 0; $ipost_title)) { $results[$i]->post_title = 'No Title'; } ?>
Title Reindex Remove from index
post_title; ?> Reindex Remove From Index
; prefix . "als_log"; $sql = "SELECT * FROM $searches_log_table WHERE $conditions ORDER BY $order_by LIMIT $limit"; $results = $wpdb->get_results($sql); if(count($results)<1){ if(!$no_results_msg) { _e('No stats to show.','als-lite'); } else { echo $no_results_msg; } return; } ?> time); echo ""; echo ""; echo ""; echo ""; } ?>
Query Searches Results Last Search
$single->query$single->searches$single->hits$time
prefix . "als_log"; $sql = "SELECT SUM(searches) as total FROM $searches_log_table WHERE $where"; $results = $wpdb->get_results($sql); if ($echo) { echo intval($results[0]->total); } return intval($results[0]->total); } /** * Get a setting from the settings API. * * @param mixed $option_name the name of the option to retrieve * @param mixed $default the default value of the option name * @return string */ public static function get_option( $option_name, $default = '' ) { $option_value = get_option( $option_name, null ); if ( is_array( $option_value ) ) { $option_value = array_map( 'stripslashes', $option_value ); } elseif ( ! is_null( $option_value ) ) { $option_value = stripslashes( $option_value ); } return $option_value === null ? $default : $option_value; } /** * Settings page. * * Handles the display of the main als settings page in admin. */ public static function output() { global $current_tab; do_action( 'als_settings_start' ); // Include settings pages self::get_settings_pages(); // Get current tab $current_tab = empty( $_GET['tab'] ) ? 'searching' : sanitize_title( $_GET['tab'] ); if($current_tab == 'searching'){ self::show_index_details(); } // Save settings if data has been posted if ( ! empty( $_POST ) ) { self::save(); } // Add any posted messages if ( ! empty( $_GET['als_error'] ) ) { self::add_error( stripslashes( $_GET['als_error'] ) ); } if ( ! empty( $_GET['als_message'] ) ) { self::add_message( stripslashes( $_GET['als_message'] ) ); } // Get tabs for the settings page $tabs = apply_filters( 'als_settings_tabs_array', array() ); include ALS_LITE__PLUGIN_DIR . 'includes/admin/html-admin-settings.php'; } /** * Save the settings. */ public static function save() { global $current_tab; if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'als-settings' ) ) { die( __( 'Action failed. Please refresh the page and retry.', 'als-lite' ) ); } // Trigger actions do_action( 'als_settings_save_' . $current_tab ); do_action( 'als_update_options_' . $current_tab ); do_action( 'als_update_options' ); self::add_message( __( 'Your settings have been saved.', 'als-lite' ) ); do_action( 'als_settings_saved' ); } /** * Include the settings page classes. */ public static function get_settings_pages() { if ( empty( self::$settings ) ) { $settings = array(); include_once( ALS_LITE__PLUGIN_DIR . 'includes/admin/class-als-settings-page.php' ); $settings[] = include( ALS_LITE__PLUGIN_DIR . 'includes/admin/searching.php'); $settings[] = include( ALS_LITE__PLUGIN_DIR . 'includes/admin/result_pages.php' ); self::$settings = apply_filters( 'als_get_settings_pages', $settings ); } return self::$settings; } /** * Output admin fields. * * Loops though the als options array and outputs each field. * * @param array $options Opens array to output */ public static function output_fields( $options ) { foreach ( $options as $value ) { if ( ! isset( $value['type'] ) ) { continue; } if ( ! isset( $value['id'] ) ) { $value['id'] = ''; } if ( ! isset( $value['title'] ) ) { $value['title'] = isset( $value['name'] ) ? $value['name'] : ''; } if ( ! isset( $value['class'] ) ) { $value['class'] = ''; } if ( ! isset( $value['css'] ) ) { $value['css'] = ''; } if ( ! isset( $value['default'] ) ) { $value['default'] = ''; } if ( ! isset( $value['desc'] ) ) { $value['desc'] = ''; } if ( ! isset( $value['desc_tip'] ) ) { $value['desc_tip'] = false; } if ( ! isset( $value['placeholder'] ) ) { $value['placeholder'] = ''; } // Custom attribute handling $custom_attributes = array(); if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) { foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) { $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; } } // Description handling $field_description = self::get_field_description( $value ); extract( $field_description ); // Switch based on type switch ( $value['type'] ) { // Section Titles case 'title': if ( ! empty( $value['title'] ) ) { echo '

' . esc_html( $value['title'] ) . '

'; } if ( ! empty( $value['desc'] ) ) { echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); } echo ''. "\n\n"; if ( ! empty( $value['id'] ) ) { do_action( 'als_settings_' . sanitize_title( $value['id'] ) ); } break; // Section Ends case 'sectionend': if ( ! empty( $value['id'] ) ) { do_action( 'als_settings_' . sanitize_title( $value['id'] ) . '_end' ); } echo '
'; if ( ! empty( $value['id'] ) ) { do_action( 'als_settings_' . sanitize_title( $value['id'] ) . '_after' ); } break; // Standard text inputs and subtypes like 'number' case 'text': case 'email': case 'number': case 'color' : case 'password' : $type = $value['type']; $option_value = self::get_option( $value['id'], $value['default'] ); ?> />
$value['id'], 'id' => $value['id'], 'sort_column' => 'menu_order', 'sort_order' => 'ASC', 'show_option_none' => ' ', 'class' => $value['class'], 'echo' => false, 'selected' => absint( self::get_option( $value['id'] ) ) ); if ( isset( $value['args'] ) ) { $args = wp_parse_args( $value['args'], $args ); } ?> ' . wp_kses_post( $description ) . '

'; } elseif ( $description && in_array( $value['type'], array( 'checkbox' ) ) ) { $description = wp_kses_post( $description ); } elseif ( $description ) { $description = '' . wp_kses_post( $description ) . ''; } if ( $tooltip_html && in_array( $value['type'], array( 'checkbox' ) ) ) { $tooltip_html = '

' . $tooltip_html . '

'; } elseif ( $tooltip_html ) { $tooltip_html = als_help_tip( $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; } /** * Indexing stuff */ public static function show_index_details(){ if(isset($_POST['als_index_more'])) { $index = als_index_new(); self::add_message( __( 'Posts added to index.', 'als-lite' ) ); } $indexed = get_option('als_indexed_posts', 0); $total = als_total_indexable(); self::add_message( als_indexed_count() . __( ' Posts indexed; Out of a total of ', 'als-lite' ) . $total ); } }