|
1 <?php |
|
2 if ( get_magic_quotes_gpc() ) { |
|
3 $_POST = array_map( 'stripslashes_deep', $_POST ); |
|
4 $_GET = array_map( 'stripslashes_deep', $_GET ); |
|
5 $_COOKIE = array_map( 'stripslashes_deep', $_COOKIE ); |
|
6 $_REQUEST = array_map( 'stripslashes_deep', $_REQUEST ); |
|
7 } |
|
8 |
|
9 $themename = "Aparatus"; |
|
10 $shortname = "apa"; |
|
11 $options = array ( |
|
12 |
|
13 array( "name" => "General Settings", |
|
14 "type" => "sub-title"), |
|
15 array( "type" => "open"), |
|
16 array( "name" => "Style Sheet", |
|
17 "desc" => "Enter the Style Sheet you like", |
|
18 "id" => $shortname."_style_sheet", |
|
19 "type" => "select", |
|
20 "options" => array("maroon", "black", "blue", "green"), |
|
21 "std" => "maroon"), |
|
22 array( "name" => "Twitter Account", |
|
23 "desc" => "Enter the your Twitter Account", |
|
24 "id" => $shortname."_Twitter", |
|
25 "type" => "text", |
|
26 "std" => ""), |
|
27 array( "type" => "close"), |
|
28 |
|
29 array( "name" => "Home Page Settings", |
|
30 "type" => "sub-title"), |
|
31 array( "type" => "open"), |
|
32 |
|
33 array( "name" => "No Slideshow?", |
|
34 "desc" => "Click this box if you DONT want to use the Mootools Slideshow", |
|
35 "id" => $shortname."_use_slide_show", |
|
36 "type" => "checkbox", |
|
37 "std" => ""), |
|
38 array( "name" => "Dont automatic Slide?", |
|
39 "desc" => "Click this box if you DONT want the Slideshow to slide on load", |
|
40 "id" => $shortname."_auto_slide_show", |
|
41 "type" => "checkbox", |
|
42 "std" => ""), |
|
43 array( "name" => "Category Name for the Content Slider", |
|
44 "desc" => "Enter the category name of the posts you would like to show up in the content slider. If you don't enter a value, The latest 5 Posts will be used", |
|
45 "id" => $shortname."_feature_cat_name", |
|
46 "type" => "text", |
|
47 "std" => ""), |
|
48 array( "type" => "close"), |
|
49 |
|
50 array( "name" => "Advertising Blocks", |
|
51 "type" => "sub-title"), |
|
52 array( "type" => "open"), |
|
53 |
|
54 array( "name" => "300 x 250 Big Ad Block Image Source", |
|
55 "desc" => "Enter the Full Image URL of the 300 x 250 Ad block in the Sidebar here", |
|
56 "id" => $shortname."_ad300x250image", |
|
57 "type" => "text", |
|
58 "std" => ""), |
|
59 array( "name" => "300 x 250 Big Ad Block Click Destination", |
|
60 "desc" => "Enter the Click Destination URL of the 300 x 250 Ad block in the Sidebar here", |
|
61 "id" => $shortname."_ad300x250destination", |
|
62 "type" => "text", |
|
63 "std" => ""), |
|
64 |
|
65 array( "name" => "1st Small Ad Block Image Source", |
|
66 "desc" => "Enter the Full Image URL of the first 125 x 125 Small Ad block in the Sidebar here", |
|
67 "id" => $shortname."_1_ad_image", |
|
68 "type" => "text", |
|
69 "std" => ""), |
|
70 array( "name" => "1st Small Ad Block Click Destination", |
|
71 "desc" => "Enter the Click Destination URL of the first 125 x 125 Small Ad block in the Sidebar here", |
|
72 "id" => $shortname."_1_ad_destination", |
|
73 "type" => "text", |
|
74 "std" => ""), |
|
75 |
|
76 array( "name" => "2nd Small Ad Block Image Source", |
|
77 "desc" => "Enter the Full Image URL of the second 125 x 125 Small Ad block in the Sidebar here", |
|
78 "id" => $shortname."_2_ad_image", |
|
79 "type" => "text", |
|
80 "std" => ""), |
|
81 array( "name" => "2nd Small Ad Block Click Destination", |
|
82 "desc" => "Enter the Click Destination URL of the second 125 x 125 Small Ad block in the Sidebar here", |
|
83 "id" => $shortname."_2_ad_destination", |
|
84 "type" => "text", |
|
85 "std" => ""), |
|
86 |
|
87 array( "name" => "3rd Small Ad Block Image Source", |
|
88 "desc" => "Enter the Full Image URL of the third 125 x 125 Small Ad block in the Sidebar here", |
|
89 "id" => $shortname."_3_ad_image", |
|
90 "type" => "text", |
|
91 "std" => ""), |
|
92 array( "name" => "3rd Small Ad Block Click Destination", |
|
93 "desc" => "Enter the Click Destination URL of the third 125 x 125 Small Ad block in the Sidebar here", |
|
94 "id" => $shortname."_1_ad_destination", |
|
95 "type" => "text", |
|
96 "std" => ""), |
|
97 |
|
98 array( "name" => "4th Small Ad Block Image Source", |
|
99 "desc" => "Enter the Full Image URL of the fourth 125 x 125 Small Ad block in the Sidebar here", |
|
100 "id" => $shortname."_4_ad_image", |
|
101 "type" => "text", |
|
102 "std" => ""), |
|
103 array( "name" => "4th Small Ad Block Click Destination", |
|
104 "desc" => "Enter the Click Destination URL fourth 125 x 125 Small Ad block in the Sidebar here", |
|
105 "id" => $shortname."_4_ad_destination", |
|
106 "type" => "text", |
|
107 "std" => ""), |
|
108 |
|
109 |
|
110 |
|
111 array( "type" => "close") |
|
112 ); |
|
113 |
|
114 //presentation// |
|
115 |
|
116 function mytheme_add_admin() { |
|
117 |
|
118 global $themename, $shortname, $options; |
|
119 |
|
120 if ( $_GET['page'] == basename(__FILE__) ) { |
|
121 |
|
122 if ( 'save' == $_REQUEST['action'] ) { |
|
123 |
|
124 foreach ($options as $value) { |
|
125 update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } |
|
126 |
|
127 foreach ($options as $value) { |
|
128 if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } } |
|
129 |
|
130 header("Location: themes.php?page=functions.php&saved=true"); |
|
131 die; |
|
132 |
|
133 } else if( 'reset' == $_REQUEST['action'] ) { |
|
134 |
|
135 foreach ($options as $value) { |
|
136 delete_option( $value['id'] ); } |
|
137 |
|
138 header("Location: themes.php?page=functions.php&reset=true"); |
|
139 die; |
|
140 |
|
141 } |
|
142 } |
|
143 |
|
144 add_theme_page($themename." Options", "".$themename." Options", 'edit_themes', basename(__FILE__), 'mytheme_admin'); |
|
145 |
|
146 } |
|
147 |
|
148 function mytheme_admin() { |
|
149 |
|
150 global $themename, $shortname, $options; |
|
151 |
|
152 if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings saved.</strong></p></div>'; |
|
153 if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings reset.</strong></p></div>'; |
|
154 |
|
155 ?> |
|
156 <div class="wrap"> |
|
157 <h2><?php echo $themename; ?> Settings</h2> |
|
158 |
|
159 <form method="post"> |
|
160 |
|
161 <?php foreach ($options as $value) { |
|
162 switch ( $value['type'] ) { |
|
163 |
|
164 case "open": |
|
165 ?> |
|
166 <table width="100%" border="0" style="background-color:#eef5fb; padding:10px;"> |
|
167 |
|
168 <?php break; |
|
169 |
|
170 case "close": |
|
171 ?> |
|
172 |
|
173 </table><br /> |
|
174 |
|
175 <?php break; |
|
176 |
|
177 case "title": |
|
178 ?> |
|
179 <table width="100%" border="0" style="background-color:#dceefc; padding:5px 10px;"><tr> |
|
180 <td valign="top" colspan="2"><h3 style="font-family:Georgia,'Times New Roman',Times,serif;"><?php echo $value['name']; ?></h3></td> |
|
181 </tr> |
|
182 |
|
183 <!--custom--> |
|
184 |
|
185 |
|
186 <?php break; |
|
187 case "sub-title": |
|
188 ?> |
|
189 <h3 style="font-family:Georgia,'Times New Roman',Times,serif; padding-left:8px;"><?php echo $value['name']; ?></h3> |
|
190 <!--end-of-custom--> |
|
191 |
|
192 |
|
193 <?php break; |
|
194 |
|
195 case 'text': |
|
196 ?> |
|
197 |
|
198 <tr> |
|
199 <td valign="top" width="20%" rowspan="2" valign="middle"><strong><?php echo $value['name']; ?></strong></td> |
|
200 <td width="80%"><input style="width:400px;" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" /></td> |
|
201 </tr> |
|
202 |
|
203 <tr> |
|
204 <td><small><?php echo $value['desc']; ?></small></td> |
|
205 </tr><tr><td colspan="2" style="margin-bottom:5px;border-bottom:1px dotted #000000;"> </td></tr><tr><td colspan="2"> </td></tr> |
|
206 |
|
207 <?php |
|
208 break; |
|
209 |
|
210 case 'textarea': |
|
211 ?> |
|
212 |
|
213 <tr> |
|
214 <td valign="top" width="20%" rowspan="2" valign="middle"><strong><?php echo $value['name']; ?></strong></td> |
|
215 <td width="80%"><textarea name="<?php echo $value['id']; ?>" style="width:400px; height:200px;" type="<?php echo $value['type']; ?>" cols="" rows=""><?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?></textarea></td> |
|
216 |
|
217 </tr> |
|
218 |
|
219 <tr> |
|
220 <td><small><?php echo $value['desc']; ?></small></td> |
|
221 </tr><tr><td colspan="2" style="margin-bottom:5px;border-bottom:1px dotted #000000;"> </td></tr><tr><td colspan="2"> </td></tr> |
|
222 |
|
223 <?php |
|
224 break; |
|
225 |
|
226 case 'select': |
|
227 ?> |
|
228 <tr> |
|
229 <td width="20%" rowspan="2" valign="middle"><strong><?php echo $value['name']; ?></strong></td> |
|
230 <td width="80%"><select style="width:240px;" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>"><?php foreach ($value['options'] as $option) { ?><option<?php if ( get_settings( $value['id'] ) == $option) { echo ' selected="selected"'; } elseif ($option == $value['std']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option><?php } ?></select></td> |
|
231 </tr> |
|
232 |
|
233 <tr> |
|
234 <td><small><?php echo $value['desc']; ?></small></td> |
|
235 </tr><tr><td colspan="2" style="margin-bottom:5px;border-bottom:1px dotted #000000;"> </td></tr><tr><td colspan="2"> </td></tr> |
|
236 |
|
237 <?php |
|
238 break; |
|
239 |
|
240 case "checkbox": |
|
241 ?> |
|
242 <tr> |
|
243 <td width="20%" rowspan="2" valign="middle"><strong><?php echo $value['name']; ?></strong></td> |
|
244 <td width="80%"><?php if(get_option($value['id'])){ $checked = "checked=\"checked\""; }else{ $checked = "";} ?> |
|
245 <input type="checkbox" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> /> |
|
246 </td> |
|
247 </tr> |
|
248 |
|
249 <tr> |
|
250 <td><small><?php echo $value['desc']; ?></small></td> |
|
251 </tr><tr><td colspan="2" style="margin-bottom:5px;border-bottom:1px dotted #000000;"> </td></tr><tr><td colspan="2"> </td></tr> |
|
252 |
|
253 <?php break; |
|
254 |
|
255 } |
|
256 } |
|
257 ?> |
|
258 |
|
259 <p class="submit"> |
|
260 <input name="save" type="submit" value="Save changes" /> |
|
261 <input type="hidden" name="action" value="save" /> |
|
262 </p> |
|
263 </form> |
|
264 <form method="post"> |
|
265 <p class="submit"> |
|
266 <input name="reset" type="submit" value="Reset" /> |
|
267 <input type="hidden" name="action" value="reset" /> |
|
268 </p> |
|
269 </form> |
|
270 |
|
271 <?php |
|
272 } |
|
273 add_action('admin_menu', 'mytheme_add_admin'); |
|
274 |
|
275 ?> |
|
276 <?php |
|
277 function new_excerpt_length($length) { |
|
278 return 60; |
|
279 } |
|
280 add_filter('excerpt_length', 'new_excerpt_length'); |
|
281 ?> |
|
282 <?php |
|
283 //widtetize// |
|
284 if ( function_exists('register_sidebar') ) |
|
285 |
|
286 register_sidebar(array('name'=>'sidebar', |
|
287 'before_widget' => '<div class="sidebar-row">', |
|
288 'after_widget' => '</div>', |
|
289 'before_title' => '<h3>', |
|
290 'after_title' => '</h3>', |
|
291 )); |
|
292 |
|
293 add_filter('get_comments_number', 'comment_count', 0); |
|
294 function comment_count( $count ) { |
|
295 if ( ! is_admin() ) { |
|
296 global $id; |
|
297 $comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id)); |
|
298 return count($comments_by_type['comment']); |
|
299 } else { |
|
300 return $count; |
|
301 } |
|
302 } |
|
303 add_action( 'wp_print_styles', 'my_deregister_styles', 100 ); |
|
304 ?> |
|
305 <?php |
|
306 function my_deregister_styles() { |
|
307 wp_deregister_style( 'wp-pagenavi' ); |
|
308 } |
|
309 ?> |
|
310 <?php if (function_exists('add_theme_support')) { |
|
311 add_theme_support( 'post-thumbnails', array( 'post' ) ); // Add it for posts |
|
312 set_post_thumbnail_size( 195, 65 ); // 195 pixels wide by 65 pixels tall - class - thumbnails in archive |
|
313 } ?> |
|
314 <?php |
|
315 function popularPosts($num) { |
|
316 global $wpdb; |
|
317 |
|
318 $posts = $wpdb->get_results("SELECT comment_count, ID, post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , $num"); |
|
319 |
|
320 foreach ($posts as $post) { |
|
321 setup_postdata($post); |
|
322 $id = $post->ID; |
|
323 $title = $post->post_title; |
|
324 $count = $post->comment_count; |
|
325 |
|
326 if ($count != 0) { |
|
327 $popular .= '<li>'; |
|
328 $popular .= '<a href="' . get_permalink($id) . '" title="' . $title . '">' . $title . '</a> '; |
|
329 $popular .= '</li>'; |
|
330 } |
|
331 } |
|
332 return $popular; |
|
333 } |
|
334 function my_rec_comments($limit){ |
|
335 global $wpdb; |
|
336 $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, |
|
337 comment_post_ID, comment_author, comment_date_gmt, comment_approved, |
|
338 comment_type,comment_author_url, |
|
339 SUBSTRING(comment_content,1,30) AS com_excerpt |
|
340 FROM $wpdb->comments |
|
341 LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = |
|
342 $wpdb->posts.ID) |
|
343 WHERE comment_approved = '1' AND comment_type = '' AND |
|
344 post_password = '' |
|
345 ORDER BY comment_date_gmt DESC |
|
346 LIMIT $limit"; |
|
347 $comments = $wpdb->get_results($sql); |
|
348 $output = $pre_HTML; |
|
349 $output .= "\n<ul>"; |
|
350 foreach ($comments as $comment) { |
|
351 $output .= "\n<li>".strip_tags($comment->comment_author) |
|
352 .":" . "<a href=\"" . get_permalink($comment->ID) . |
|
353 "#comment-" . $comment->comment_ID . "\" title=\"on " . |
|
354 $comment->post_title . "\">" . strip_tags($comment->com_excerpt) |
|
355 ."</a></li>"; |
|
356 } |
|
357 $output .= "\n</ul>"; |
|
358 $output .= $post_HTML; |
|
359 echo $output; |
|
360 |
|
361 } |
|
362 |
|
363 ?> |
|
364 <? if(!function_exists(amt_cif)) { require_once('functions.wp-amt.php'); } ?> |