function se_global_notice()
{
    global $pagenow, $se_global_notice_pages;
    if (!current_user_can('manage_options')) {
        return;
    }
    $se_meta = se_get_meta();
    $close_url = admin_url('options-general.php');
    $close_url = add_query_arg(array('page' => 'extend_search', 'se_global_notice' => 0), $close_url);
    $notice = $se_meta['se_global_notice'];
    if ($notice && in_array($pagenow, $se_global_notice_pages)) {
        include se_get_view('global_notice');
    }
}
Beispiel #2
0
 function se_option_page()
 {
     global $wpdb, $table_prefix, $wp_version;
     if ($_POST) {
         check_admin_referer('se-everything-nonce');
         $errors = $this->se_validation(array("highlight_color" => "color", "highlight_style" => "css", "exclude_categories_list" => "numeric-comma", "exclude_posts_list" => "numeric-comma"));
         if ($errors) {
             $fields = array("highlight_color" => __('Highlight Background Color', 'SearchEverything'), "highlight_style" => __('Full Highlight Style', 'SearchEverything'), "exclude_categories_list" => __('Exclude Categories', 'SearchEverything'), "exclude_posts_list" => __('Exclude some post or page IDs', 'SearchEverything'));
             include se_get_view('options_page_errors');
             return;
         }
     }
     $new_options = array('se_exclude_categories' => isset($_POST['exclude_categories']) && !empty($_POST['exclude_categories']) ? $_POST['exclude_categories'] : '', 'se_exclude_categories_list' => isset($_POST['exclude_categories_list']) && !empty($_POST['exclude_categories_list']) ? $_POST['exclude_categories_list'] : '', 'se_exclude_posts' => isset($_POST['exclude_posts']) ? $_POST['exclude_posts'] : '', 'se_exclude_posts_list' => isset($_POST['exclude_posts_list']) && !empty($_POST['exclude_posts_list']) ? $_POST['exclude_posts_list'] : '', 'se_use_page_search' => isset($_POST['search_pages']) && $_POST['search_pages'], 'se_use_comment_search' => isset($_POST['search_comments']) && $_POST['search_comments'], 'se_use_tag_search' => isset($_POST['search_tags']) && $_POST['search_tags'], 'se_use_tax_search' => isset($_POST['search_taxonomies']) && $_POST['search_taxonomies'], 'se_use_category_search' => isset($_POST['search_categories']) && $_POST['search_categories'], 'se_approved_comments_only' => isset($_POST['appvd_comments']) && $_POST['appvd_comments'], 'se_approved_pages_only' => isset($_POST['appvd_pages']) && $_POST['appvd_pages'], 'se_use_excerpt_search' => isset($_POST['search_excerpt']) && $_POST['search_excerpt'], 'se_use_draft_search' => isset($_POST['search_drafts']) && $_POST['search_drafts'], 'se_use_attachment_search' => isset($_POST['search_attachments']) && $_POST['search_attachments'], 'se_use_authors' => isset($_POST['search_authors']) && $_POST['search_authors'], 'se_use_cmt_authors' => isset($_POST['search_cmt_authors']) && $_POST['search_cmt_authors'], 'se_use_metadata_search' => isset($_POST['search_metadata']) && $_POST['search_metadata'], 'se_use_highlight' => isset($_POST['search_highlight']) && $_POST['search_highlight'], 'se_highlight_color' => isset($_POST['highlight_color']) ? $_POST['highlight_color'] : '', 'se_highlight_style' => isset($_POST['highlight_style']) ? $_POST['highlight_style'] : '', 'se_research_metabox' => array('visible_on_compose' => isset($_POST['research_metabox']) && $_POST['research_metabox'], 'external_search_enabled' => isset($_POST['research_external_results']) && $_POST['research_external_results']));
     if (isset($_POST['action']) && $_POST['action'] == "save") {
         echo "<div class=\"updated fade\" id=\"limitcatsupdatenotice\"><p>" . __('Your default search settings have been <strong>updated</strong> by Search Everything. </p><p> What are you waiting for? Go check out the new search results!', 'SearchEverything') . "</p></div>";
         se_update_options($new_options);
     }
     if (isset($_POST['action']) && $_POST['action'] == "reset") {
         echo "<div class=\"updated fade\" id=\"limitcatsupdatenotice\"><p>" . __('Your default search settings have been <strong>updated</strong> by Search Everything. </p><p> What are you waiting for? Go check out the new search results!', 'SearchEverything') . "</p></div>";
         $default_options = se_get_default_options();
         se_update_options($default_options);
     }
     $options = se_get_options();
     $meta = se_get_meta();
     //get api key if it doesn't exist
     if ($options['se_research_metabox']['external_search_enabled'] && empty($meta['api_key'])) {
         $api_key = fetch_api_key();
         $meta['api_key'] = $api_key;
         se_update_meta($meta);
     }
     if ($options['se_research_metabox']['external_search_enabled'] && !empty($meta['api_key'])) {
         se_get_prefs();
     }
     $response_messages = se_get_response_messages();
     $external_message = "";
     if (!empty($meta['api_key']) && empty($meta['sfid'])) {
         $sfid_response = get_sfid();
         if (!empty($sfid_response[0])) {
             $meta['sfid'] = $sfid_response[1];
             se_update_meta($meta);
         }
         $external_message = !empty($response_messages[$sfid_response[1]]) ? $response_messages[$sfid_response[1]] : $response_messages[SE_PREFS_STATE_FAILED];
     } elseif (!empty($meta['sfid'])) {
         $external_message = $response_messages[SE_PREFS_STATE_FOUND];
     }
     include se_get_view('options_page');
 }