| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | Class SearchEverythingAdmin { |
|---|
| 4 | |
|---|
| 5 | var $version = '4.7.6'; |
|---|
| 6 | |
|---|
| 7 | function SearchEverythingAdmin() { |
|---|
| 8 | |
|---|
| 9 | // Load language file |
|---|
| 10 | $locale = get_locale(); |
|---|
| 11 | if ( !empty($locale) ) |
|---|
| 12 | load_textdomain('SearchEverything', SE_ABSPATH .'lang/SE4-'.$locale.'.mo'); |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | add_action('admin_head', array(&$this, 'SE4_options_style')); |
|---|
| 16 | add_action('admin_menu', array(&$this, 'SE4_add_options_panel')); |
|---|
| 17 | |
|---|
| 18 | } |
|---|
| 19 | |
|---|
| 20 | function SE4_add_options_panel() { |
|---|
| 21 | add_options_page('Search', 'Search Everything', 7, 'manage_search', array(&$this, 'SE4_option_page')); |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | //build admin interface |
|---|
| 25 | function SE4_option_page() { |
|---|
| 26 | global $wpdb, $table_prefix, $wp_version; |
|---|
| 27 | |
|---|
| 28 | if($_POST['action'] == "save") { |
|---|
| 29 | echo "<div class=\"updated fade\" id=\"limitcatsupdatenotice\"><p>" . __("Search Everything Options <strong>Updated</strong>.") . "</p></div>"; |
|---|
| 30 | |
|---|
| 31 | $new_options = array( |
|---|
| 32 | 'SE4_exclude_categories' => $_POST["exclude_categories"], |
|---|
| 33 | 'SE4_exclude_categories_list' => $_POST["exclude_categories_list"], |
|---|
| 34 | 'SE4_exclude_posts' => $_POST["exclude_posts"], |
|---|
| 35 | 'SE4_exclude_posts_list' => $_POST["exclude_posts_list"], |
|---|
| 36 | 'SE4_use_page_search' => $_POST["search_pages"], |
|---|
| 37 | 'SE4_use_comment_search' => $_POST["search_comments"], |
|---|
| 38 | 'SE4_use_tag_search' => $_POST["search_tags"], |
|---|
| 39 | 'SE4_use_category_search' => $_POST["search_categories"], |
|---|
| 40 | 'SE4_approved_comments_only' => $_POST["appvd_comments"], |
|---|
| 41 | 'SE4_approved_pages_only' => $_POST["appvd_pages"], |
|---|
| 42 | 'SE4_use_excerpt_search' => $_POST["search_excerpt"], |
|---|
| 43 | 'SE4_use_draft_search' => $_POST["search_drafts"], |
|---|
| 44 | 'SE4_use_attachment_search' => $_POST["search_attachments"], |
|---|
| 45 | 'SE4_use_metadata_search' => $_POST["search_metadata"] |
|---|
| 46 | ); |
|---|
| 47 | |
|---|
| 48 | update_option("search_tag", $_POST["SE4_use_tag_search"]); |
|---|
| 49 | update_option("SE4_options", $new_options); |
|---|
| 50 | |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | $options = get_option('SE4_options'); |
|---|
| 54 | $search_tag = get_option('search_tag'); |
|---|
| 55 | |
|---|
| 56 | ?> |
|---|
| 57 | |
|---|
| 58 | <div class="wrap"> |
|---|
| 59 | <h2>Search Everything (SE) Version: <?php echo $this->version; ?></h2> |
|---|
| 60 | |
|---|
| 61 | <table class="form-table"> |
|---|
| 62 | <tr valign="top"> |
|---|
| 63 | <td colspan="4" bgcolor="#DDD"><?php _e('Use this form to configure your search options.', 'SearchEverything'); ?><br /> |
|---|
| 64 | <?php _e('The options selected below will be used in every search query on this site; in addition to the built-in post search.','SearchEverything'); ?></td> |
|---|
| 65 | </tr> |
|---|
| 66 | <tr> |
|---|
| 67 | <td> |
|---|
| 68 | <form method="post"> |
|---|
| 69 | <legend><?php _e('Search Options Form', 'SearchEverything'); ?></legend> |
|---|
| 70 | <p><input type="checkbox" id="exclude_posts" name="exclude_posts" value="true" <?php if($options['SE4_exclude_posts'] == 'true') { echo 'checked="true"'; } ?> /> |
|---|
| 71 | <label for="exclude_posts"><?php _e('Exclude some post or page IDs','SearchEverything'); ?></label><br /> |
|---|
| 72 | <label for="exclude_posts_list" class="SE_text_label"><?php _e('Comma separated Post IDs (example: 1, 5, 9)','SearchEverything'); ?></label><br /> |
|---|
| 73 | <input type="text" size="50" class="SE_text_input" id="exclude_posts_list" name="exclude_posts_list" value="<?php echo $options['SE4_exclude_posts_list'];?>" /></p> |
|---|
| 74 | |
|---|
| 75 | <p><input type="checkbox" id="exclude_categories" name="exclude_categories" value="true" <?php if($options['SE4_exclude_categories'] == 'true') { echo 'checked="true"'; } ?> /> |
|---|
| 76 | <label for="exclude_categories"><?php _e('Exclude Categories','SearchEverything'); ?></label><br /> |
|---|
| 77 | <label for="exclude_categories_list" class="SE_text_label"><?php _e('Comma separated category IDs (example: 1, 4)','SearchEverything'); ?></label><br /> |
|---|
| 78 | <input type="text" size="50" class="SE_text_input" id="exclude_categories_list" name="exclude_categories_list" value="<?php echo $options['SE4_exclude_categories_list'];?>" /></p> |
|---|
| 79 | |
|---|
| 80 | <p><input type="checkbox" id="search_pages" name="search_pages" value="true" <?php if($options['SE4_use_page_search'] == 'true') { echo 'checked="true"'; } ?> /> |
|---|
| 81 | <label for="search_pages"><?php _e('Search every page (non-password protected)','SearchEverything'); ?></label></p> |
|---|
| 82 | <p> <input type="checkbox" class="SE_text_input" id="appvd_pages" name="appvd_pages" value="true" <?php if($options['SE4_approved_pages_only'] == 'true') { echo 'checked="true"'; } ?> |
|---|
| 83 | <label for="appvd_pages"><?php _e('Search approved pages only?','SearchEverything'); ?></label></p> |
|---|
| 84 | |
|---|
| 85 | <?php |
|---|
| 86 | // Show tags only for WP 2.3+ |
|---|
| 87 | If ($wp_version >= '2.3') { ?> |
|---|
| 88 | <p><input type="checkbox" id="search_tags" name="search_tags" value="true" <?php if($options['SE4_use_tag_search'] == 'true') { echo 'checked="true"'; } ?> /> |
|---|
| 89 | <label for="search_tags"><?php _e('Search every tag name','SearchEverything'); ?></label></p> |
|---|
| 90 | <?php } ?> |
|---|
| 91 | |
|---|
| 92 | <?php |
|---|
| 93 | // Show categories only for WP 2.5+ |
|---|
| 94 | If ($wp_version >= '2.5') { ?> |
|---|
| 95 | <p><input type="checkbox" id="search_categories" name="search_categories" value="true" <?php if($options['SE4_use_category_search'] == 'true') { echo 'checked="true"'; } ?> /> |
|---|
| 96 | <label for="search_categories"><?php _e('Search every category name','SearchEverything'); ?></label></p> |
|---|
| 97 | <?php } ?> |
|---|
| 98 | |
|---|
| 99 | <p><input type="checkbox" id="search_comments" name="search_comments" value="true" <?php if($options['SE4_use_comment_search'] == 'true') { echo 'checked="true"'; } ?> /> |
|---|
| 100 | <label for="search_comments"><?php _e('Search every comment','SearchEverything'); ?></label></p> |
|---|
| 101 | |
|---|
| 102 | <p> <input type="checkbox" class="SE_text_input" id="appvd_comments" name="appvd_comments" value="true" <?php if($options['SE4_approved_comments_only'] == 'true') { echo 'checked="true"'; } ?> /> |
|---|
| 103 | <label for="appvd_comments"><?php _e('Search approved comments only?','SearchEverything'); ?></label></p> |
|---|
| 104 | |
|---|
| 105 | <p><input type="checkbox" id="search_excerpt" name="search_excerpt" value="true" <?php if($options['SE4_use_excerpt_search'] == 'true') { echo 'checked="true"'; } ?> /> |
|---|
| 106 | <label for="search_excerpt"><?php _e('Search every excerpt','SearchEverything'); ?></label></p> |
|---|
| 107 | <?php |
|---|
| 108 | // Show drafts only for WP 2.3+ |
|---|
| 109 | If ($wp_version < '2.5') { ?> |
|---|
| 110 | <p><input type="checkbox" id="search_drafts" name="search_drafts" value="true" <?php if($options['SE4_use_draft_search'] == 'true') { echo 'checked="true"'; } ?> /> |
|---|
| 111 | <label for="search_drafts"><?php _e('Search every draft','SearchEverything'); ?></label></p> |
|---|
| 112 | <?php } ?> |
|---|
| 113 | <p><input type="checkbox" id="search_attachments" name="search_attachments" value="true" <?php if($options['SE4_use_attachment_search'] == 'true') { echo 'checked="true"'; } ?> /> |
|---|
| 114 | <label for="search_attachments"><?php _e('Search every attachment','SearchEverything'); ?></label></p> |
|---|
| 115 | |
|---|
| 116 | <p><input type="checkbox" id="search_metadata" name="search_metadata" value="true" <?php if($options['SE4_use_metadata_search'] == 'true') { echo 'checked="true"'; } ?> /> |
|---|
| 117 | <label for="search_metadata"><?php _e('Search every custom field (metadata)','SearchEverything'); ?></label></p> |
|---|
| 118 | |
|---|
| 119 | </td> |
|---|
| 120 | </tr> |
|---|
| 121 | </table> |
|---|
| 122 | <div class="submit"> |
|---|
| 123 | <input type="hidden" name="action" value="save" /> |
|---|
| 124 | <input type="submit" value="<?php _e('Update Options', 'SearchEverything') ?>" /> |
|---|
| 125 | </div> |
|---|
| 126 | </form> |
|---|
| 127 | </div> |
|---|
| 128 | |
|---|
| 129 | <div class="wrap"> |
|---|
| 130 | <h2><?php _e('SE Search Form', 'SearchEverything'); ?></h2> |
|---|
| 131 | <table class="form-table"> |
|---|
| 132 | <tr valign="top"> |
|---|
| 133 | <td colspan="4" bgcolor="#DDD"><?php _e('Use this search form to run a live search test.', 'SearchEverything'); ?></td> |
|---|
| 134 | </tr> |
|---|
| 135 | <tr> |
|---|
| 136 | <td> |
|---|
| 137 | <legend><?php _e('Site Search', 'SearchEverything'); ?></legend> |
|---|
| 138 | <form method="get" id="searchform" action="<?php bloginfo('home'); ?>"><p class="srch submit"> |
|---|
| 139 | <label for="s"><?php _e('Enter search terms', 'SearchEverything'); ?><br /></label> |
|---|
| 140 | <input type="text" class="srch-txt" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" size="30" /> |
|---|
| 141 | <input type="submit" class="SE4_btn" id="searchsubmit" value="<?php _e('Run Test Search', 'SearchEverything'); ?>" /></p> |
|---|
| 142 | </form> |
|---|
| 143 | </td> |
|---|
| 144 | </tr> |
|---|
| 145 | </table> |
|---|
| 146 | </div> |
|---|
| 147 | |
|---|
| 148 | <div class="wrap"> |
|---|
| 149 | <h2>SE Project Information</h2> |
|---|
| 150 | <table class="form-table"> |
|---|
| 151 | <tr valign="top"> |
|---|
| 152 | <td colspan="4" bgcolor="#DDD"> |
|---|
| 153 | As of 2.5 I'm taking a hiatus from SE development; however I'm still committing feature updates and bug fixes from the community.<br/> |
|---|
| 154 | You should not fret, the development since Version One has primarily come from the WordPress community and as a Search Everything user myself, I’m grateful for their dedicated and continued support: |
|---|
| 155 | <ul class="SE_lists"> |
|---|
| 156 | <li><a href="http://striderweb.com/">Stephen Rider</a></li> |
|---|
| 157 | <li><a href="http://chrismeller.com/">Chris Meller</a></li> |
|---|
| 158 | <li>jdleung</li> |
|---|
| 159 | <li>Alakhnor</li> |
|---|
| 160 | <li><a href="http://kinrowan.net/">Cori Schlegel</a></li> |
|---|
| 161 | <li><a href="http://green-beast.com/">Mike Cherim</a></li> |
|---|
| 162 | <li><a href="http://blog.saddey.net/">Saddy</a></li> |
|---|
| 163 | <li><a href="http://www.reaper-x.com/">Reaper</a></li> |
|---|
| 164 | <li><a href="http://beyn.org/">BarıŠÃnver</a> (localization support)</li> |
|---|
| 165 | <li><a href="http://www.alohastone.com">alohastone</a> (localization support)</li> |
|---|
| 166 | <li><a href="http://www.fratelliditalia.eu">Domiziano Galia</a></li> |
|---|
| 167 | <li><a href="http://meandmymac.net">Arnan de Gans</a> (Options panel)</li> |
|---|
| 168 | <li>Uli Iserloh</li> |
|---|
| 169 | </ul> |
|---|
| 170 | </td> |
|---|
| 171 | </tr> |
|---|
| 172 | <tr> |
|---|
| 173 | <td bgcolor="#DDD"> |
|---|
| 174 | If you’d like to contribute there’s a lot to do: |
|---|
| 175 | <ul class="SE_lists"> |
|---|
| 176 | <strong><li>Search Options for Visitor.</li></strong> |
|---|
| 177 | <li>More meta data functions.</li> |
|---|
| 178 | <li>Search Bookmarks.</li> |
|---|
| 179 | <li>…anything else you want to add.</li> |
|---|
| 180 | </ul> |
|---|
| 181 | </td> |
|---|
| 182 | </tr> |
|---|
| 183 | <tr> |
|---|
| 184 | <td bgcolor="#DDD"> |
|---|
| 185 | The current project home is at <a href="http://scatter3d.com/">scatter3d.com</a>. If you want to contribute <a href="mailto:dancameron+se@gmail.com">e-mail me</a> your modifications.<br /> |
|---|
| 186 | Respectfully,<br /> |
|---|
| 187 | <a href="http://dancameron.org/">Dan Cameron</a> |
|---|
| 188 | </td> |
|---|
| 189 | </tr> |
|---|
| 190 | </table> |
|---|
| 191 | </div> |
|---|
| 192 | |
|---|
| 193 | <?php |
|---|
| 194 | } //end SE4_option_page |
|---|
| 195 | |
|---|
| 196 | //styling options page |
|---|
| 197 | function SE4_options_style() { |
|---|
| 198 | ?> |
|---|
| 199 | <style type="text/css" media="screen"> |
|---|
| 200 | div.SE4 p.submit, div.SE4 form p.submit, div.SE4 p.submit input { text-align:left; } |
|---|
| 201 | #SE4_options_panel p.submit { text-align:left; } |
|---|
| 202 | form#searchform label, form#searchform input, form#SE_form label, form#SE_form input { margin-left:10px; } |
|---|
| 203 | input.SE4_btn { cursor:pointer; margin-left:5px; } |
|---|
| 204 | p.srch { margin:0; margin-bottom:20px; } |
|---|
| 205 | p.submit input.srch-txt { background-color:#f4f4f4; background-image:none; border:1px solid #999; padding:6px; } |
|---|
| 206 | p.submit input.srch-txt:focus, p.submit input.srch-txt:active { background-color:#fff; background-image:none; border:1px solid #111; padding:6px; } |
|---|
| 207 | p.sig { margin-left:25px; } |
|---|
| 208 | span.SE_notice { color:#cd0000; font-weight:bold; padding-left:10px; } |
|---|
| 209 | label.SE_text_label { cursor:text; } |
|---|
| 210 | form#SE_form label.SE_text_label, form#SE_form input.SE_text_input { margin-left:38px; } |
|---|
| 211 | ul.SE_lists li { list-style-type:square; } |
|---|
| 212 | </style> |
|---|
| 213 | <?php |
|---|
| 214 | } |
|---|
| 215 | |
|---|
| 216 | } |
|---|
| 217 | ?> |
|---|