changed git call from https to git readonly
[atutor.git] / mods / wordpress / sublinks.php
1 <?php
2
3 if (!defined('AT_INCLUDE_PATH')) { exit; }
4
5 /*****
6 * Free form PHP can appear here to retreive current information
7 * from the module, or a text description of the module where there is
8 * not current information
9 *****/
10 require('wp_connect.php');
11
12 global $db_wp;
13
14 $link_limit = 3;                // Number of links to be displayed on "detail view" box
15 $sql = "SELECT ID, post_title, guid FROM ".WP_DB_PREFIX."posts WHERE post_status = 'publish' ORDER BY post_modified DESC LIMIT $link_limit";
16
17 $result = mysql_query($sql, $db_wp);
18 $wp_posts = array();
19 $i = 1;
20 while($row = mysql_fetch_assoc($result)){
21         $wp_posts[$i] = $row;
22         $i++;
23 }
24
25 if($wp_posts != ''){
26         foreach($wp_posts as $key=>$value){
27         $list[] = '<a href="'.AT_BASE_HREF.url_rewrite('mods/wordpress/index.php?p='. $value['ID']).'"'.
28                                         (strlen($row['value']) > SUBLINK_TEXT_LEN ? ' title="'.$row['value'].'"' : '') .'>'. 
29                                         validate_length($value['post_title'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) .'</a>';
30         }
31         return $list;
32 } else {
33         return 0; 
34 }
35
36 ?>