diff -r 0d9a58d2c515 -r 0d28b7c10758 web/wp-content/themes/aparatus/functions.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/wp-content/themes/aparatus/functions.php Fri Mar 12 13:29:04 2010 +0000 @@ -0,0 +1,364 @@ + "General Settings", + "type" => "sub-title"), +array( "type" => "open"), +array( "name" => "Style Sheet", + "desc" => "Enter the Style Sheet you like", + "id" => $shortname."_style_sheet", + "type" => "select", + "options" => array("maroon", "black", "blue", "green"), + "std" => "maroon"), +array( "name" => "Twitter Account", + "desc" => "Enter the your Twitter Account", + "id" => $shortname."_Twitter", + "type" => "text", + "std" => ""), +array( "type" => "close"), + +array( "name" => "Home Page Settings", + "type" => "sub-title"), +array( "type" => "open"), + +array( "name" => "No Slideshow?", + "desc" => "Click this box if you DONT want to use the Mootools Slideshow", + "id" => $shortname."_use_slide_show", + "type" => "checkbox", + "std" => ""), +array( "name" => "Dont automatic Slide?", + "desc" => "Click this box if you DONT want the Slideshow to slide on load", + "id" => $shortname."_auto_slide_show", + "type" => "checkbox", + "std" => ""), +array( "name" => "Category Name for the Content Slider", + "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", + "id" => $shortname."_feature_cat_name", + "type" => "text", + "std" => ""), +array( "type" => "close"), + +array( "name" => "Advertising Blocks", + "type" => "sub-title"), +array( "type" => "open"), + +array( "name" => "300 x 250 Big Ad Block Image Source", + "desc" => "Enter the Full Image URL of the 300 x 250 Ad block in the Sidebar here", + "id" => $shortname."_ad300x250image", + "type" => "text", + "std" => ""), +array( "name" => "300 x 250 Big Ad Block Click Destination", + "desc" => "Enter the Click Destination URL of the 300 x 250 Ad block in the Sidebar here", + "id" => $shortname."_ad300x250destination", + "type" => "text", + "std" => ""), + +array( "name" => "1st Small Ad Block Image Source", + "desc" => "Enter the Full Image URL of the first 125 x 125 Small Ad block in the Sidebar here", + "id" => $shortname."_1_ad_image", + "type" => "text", + "std" => ""), +array( "name" => "1st Small Ad Block Click Destination", + "desc" => "Enter the Click Destination URL of the first 125 x 125 Small Ad block in the Sidebar here", + "id" => $shortname."_1_ad_destination", + "type" => "text", + "std" => ""), + +array( "name" => "2nd Small Ad Block Image Source", + "desc" => "Enter the Full Image URL of the second 125 x 125 Small Ad block in the Sidebar here", + "id" => $shortname."_2_ad_image", + "type" => "text", + "std" => ""), +array( "name" => "2nd Small Ad Block Click Destination", + "desc" => "Enter the Click Destination URL of the second 125 x 125 Small Ad block in the Sidebar here", + "id" => $shortname."_2_ad_destination", + "type" => "text", + "std" => ""), + +array( "name" => "3rd Small Ad Block Image Source", + "desc" => "Enter the Full Image URL of the third 125 x 125 Small Ad block in the Sidebar here", + "id" => $shortname."_3_ad_image", + "type" => "text", + "std" => ""), +array( "name" => "3rd Small Ad Block Click Destination", + "desc" => "Enter the Click Destination URL of the third 125 x 125 Small Ad block in the Sidebar here", + "id" => $shortname."_1_ad_destination", + "type" => "text", + "std" => ""), + +array( "name" => "4th Small Ad Block Image Source", + "desc" => "Enter the Full Image URL of the fourth 125 x 125 Small Ad block in the Sidebar here", + "id" => $shortname."_4_ad_image", + "type" => "text", + "std" => ""), +array( "name" => "4th Small Ad Block Click Destination", + "desc" => "Enter the Click Destination URL fourth 125 x 125 Small Ad block in the Sidebar here", + "id" => $shortname."_4_ad_destination", + "type" => "text", + "std" => ""), + + + +array( "type" => "close") +); + +//presentation// + +function mytheme_add_admin() { + +global $themename, $shortname, $options; + +if ( $_GET['page'] == basename(__FILE__) ) { + +if ( 'save' == $_REQUEST['action'] ) { + +foreach ($options as $value) { +update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } + +foreach ($options as $value) { +if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } } + +header("Location: themes.php?page=functions.php&saved=true"); +die; + +} else if( 'reset' == $_REQUEST['action'] ) { + +foreach ($options as $value) { +delete_option( $value['id'] ); } + +header("Location: themes.php?page=functions.php&reset=true"); +die; + +} +} + +add_theme_page($themename." Options", "".$themename." Options", 'edit_themes', basename(__FILE__), 'mytheme_admin'); + +} + +function mytheme_admin() { + +global $themename, $shortname, $options; + +if ( $_REQUEST['saved'] ) echo '

'.$themename.' settings saved.

'; +if ( $_REQUEST['reset'] ) echo '

'.$themename.' settings reset.

'; + +?> +
+

Settings

+ +
+ + + + + + +

+ + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + +

+ + +

+ + +

+ + + + +'sidebar', +'before_widget' => '', +'before_title' => '

', +'after_title' => '

', +)); + +add_filter('get_comments_number', 'comment_count', 0); +function comment_count( $count ) { + if ( ! is_admin() ) { + global $id; + $comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id)); + return count($comments_by_type['comment']); + } else { + return $count; + } +} +add_action( 'wp_print_styles', 'my_deregister_styles', 100 ); +?> + + +get_results("SELECT comment_count, ID, post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , $num"); + + foreach ($posts as $post) { + setup_postdata($post); + $id = $post->ID; + $title = $post->post_title; + $count = $post->comment_count; + + if ($count != 0) { + $popular .= '
  • '; + $popular .= '' . $title . ' '; + $popular .= '
  • '; + } + } + return $popular; +} +function my_rec_comments($limit){ + global $wpdb; + $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, + comment_post_ID, comment_author, comment_date_gmt, comment_approved, + comment_type,comment_author_url, + SUBSTRING(comment_content,1,30) AS com_excerpt + FROM $wpdb->comments + LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = + $wpdb->posts.ID) + WHERE comment_approved = '1' AND comment_type = '' AND + post_password = '' + ORDER BY comment_date_gmt DESC + LIMIT $limit"; + $comments = $wpdb->get_results($sql); + $output = $pre_HTML; + $output .= "\n"; + $output .= $post_HTML; + echo $output; + +} + +?> + \ No newline at end of file

    " />
     
     
     
     
     
     
    + /> +