Changeset 536 for trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php
- Timestamp:
- Mar 11, 2010, 11:49:11 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php
r534 r536 28 28 } 29 29 } 30 31 32 30 33 31 function xpress_is_contributor() … … 857 855 return $calendar; 858 856 } 857 858 function xpress_grobal_recent_posts($num = 10,$post_list='') 859 { 860 global $wpdb, $wp_rewrite , $switched , $blog_id; 861 if (empty($date_format)) $date_format = get_settings('date_format'); 862 if (empty($time_format)) $time_format = get_settings('time_format'); 863 864 $first_blogid = $blog_id; 865 $num = (int)$num; 866 // $wp_query->in_the_loop = true; //for use the_tags() in multi lopp 867 $data_array = array(); 868 if (xpress_is_multiblog()){ 869 $blogs = get_blog_list(0,'all'); 870 foreach ($blogs AS $blog) { 871 switch_to_blog($blog['blog_id']); 872 $wp_rewrite->init(); 873 874 if (empty($num)){ 875 query_posts("post_status=publish"); 876 } else { 877 query_posts("showposts=$num&post_status=publish"); 878 } 879 if (have_posts()){ 880 while(have_posts()){ 881 $data = new stdClass(); 882 883 the_post(); 884 ob_start(); 885 the_ID(); 886 $data->post_id = ob_get_contents(); 887 ob_end_clean(); 888 889 $data->brog_id = $blog['blog_id']; 890 $data->blog_name = get_bloginfo('name'); 891 $data->blog_url = get_bloginfo('url'); 892 $data->blog_link = '<a href="' . $data->blog_url . '">' . $data->blog_name . '</a>' ; 893 894 895 ob_start(); 896 the_title(); 897 $data->title = ob_get_contents(); 898 ob_end_clean(); 899 $data->post_permalink = get_blog_permalink($data->brog_id, $data->post_id); 900 $data->title_link = '<a href="' . $data->post_permalink . '">' . $data->title . '</a>' ; 901 902 ob_start(); 903 the_author_posts_link(); 904 $data->post_author = ob_get_contents(); 905 ob_end_clean(); 906 907 ob_start(); 908 the_category(' • '); 909 $data->post_category = ob_get_contents(); 910 ob_end_clean(); 911 912 if (function_exists('the_tags')){ 913 ob_start(); 914 the_tags(__('Tags:', 'xpress') . ' ',' • ',''); 915 $data->post_tags = ob_get_contents(); 916 ob_end_clean(); 917 } else { 918 $data->tags = ''; 919 } 920 921 $data->the_content = xpress_the_content('echo=0'); 922 923 ob_start(); 924 the_content(); 925 $data->the_full_content = ob_get_contents(); 926 ob_end_clean(); 927 928 ob_start(); 929 the_modified_date($date_format); 930 $data->post_modified_date = ob_get_contents(); 931 ob_end_clean(); 932 933 ob_start(); 934 the_modified_date($time_format); 935 $data->post_modified_time = ob_get_contents(); 936 ob_end_clean(); 937 $data->post_modified_date_time = $data->post_modified_date . ' ' . $data->post_modified_time; 938 939 $data->post_unix_time = xpress_get_post_unix_time($data->post_id, $data->brog_id); 940 941 ob_start(); 942 the_time($date_format); 943 $data->post_date = ob_get_contents(); 944 ob_end_clean(); 945 946 ob_start(); 947 the_time($time_format); 948 $data->post_time = ob_get_contents(); 949 ob_end_clean(); 950 951 $data->post_date_time = $data->post_date . ' ' . $data->post_time; 952 953 ob_start(); 954 comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); 955 $data->comments_link = ob_get_contents(); 956 ob_end_clean(); 957 $data_array[] = $data; 958 } // end whilwe 959 } // end if 960 restore_current_blog(); 961 // $wp_rewrite->init(); 962 } // end foreach 963 // switch_to_blog($first_blogid); 964 $wp_rewrite->init(); 965 966 restore_current_blog(); 967 usort($data_array, "the_time_cmp"); 968 } 969 970 if (!empty($num)){ 971 $data_array = array_slice($data_array,0,$num); 972 } 973 return $data_array; 974 } 975 function the_time_cmp($a, $b) 976 { 977 return - strcasecmp($a->post_unix_time, $b->post_unix_time); 978 } 979 980 function xpress_get_post_unix_time($post_id=0,$b_id=1) 981 { 982 global $wpdb; 983 $post_id= (int)$post_id; 984 $b_id = (int)$b_id; 985 986 $db_prefix = get_wp_prefix(); 987 988 if (empty($b_id)) $b_id =1; 989 $blog_prefix = ''; 990 if ($b_id >1) $blog_prefix = $b_id . '_'; 991 $post_tb = $db_prefix . $blog_prefix .'posts'; 992 993 $sql = "SELECT UNIX_TIMESTAMP(post_date) AS post_timestamp FROM $post_tb WHERE ID = $post_id"; 994 $post_timestamp = $wpdb->get_var($sql); 995 return $post_timestamp; 996 } 997 function xpress_get_blog_option($option_name,$b_id = 1) 998 { 999 global $wpdb; 1000 $db_prefix = get_wp_prefix(); 1001 1002 if (empty($b_id)) $b_id =1; 1003 $blog_prefix = ''; 1004 if ($b_id >1) $blog_prefix = $b_id . '_'; 1005 $options_tb = $db_prefix . $blog_prefix .'options'; 1006 1007 $sql = "SELECT option_value FROM $options_tb WHERE option_name = $option_name"; 1008 $ret_val = $wpdb->get_var($sql); 1009 return $ret_val; 1010 } 1011 1012 859 1013 ?>
Note: See TracChangeset
for help on using the changeset viewer.