public $id; // UUID
public $profile_id; // int
- public $title; // varchar(255)
+ public $title; // varchar(191) not 255 because utf8mb4 takes more space
public $summary; // text
public $content; // text
- public $uri; // text
- public $url; // text
+ public $uri; // varchar(191) not 255 because utf8mb4 takes more space
+ public $url; // varchar(191) not 255 because utf8mb4 takes more space
public $created; // datetime
public $modified; // datetime
'not null' => true,
'description' => 'Author profile ID'),
'title' => array('type' => 'varchar',
- 'length' => 255,
+ 'length' => 191,
'description' => 'title of the entry'),
'summary' => array('type' => 'text',
'description' => 'initial summary'),
'content' => array('type' => 'text',
'description' => 'HTML content of the entry'),
'uri' => array('type' => 'varchar',
- 'length' => 255,
+ 'length' => 191,
'description' => 'URI (probably http://) for this entry'),
'url' => array('type' => 'varchar',
- 'length' => 255,
+ 'length' => 191,
'description' => 'URL (probably http://) for this entry'),
'created' => array('type' => 'datetime',
'not null' => true,
'unique keys' => array(
'blog_entry_uri_key' => array('uri'),
),
- 'foreign keys' => array(
- 'blog_entry_profile_id_fkey' => array('profile', array('profile_id' => 'id')),
- ),
'indexes' => array(
+ 'blog_entry_profile_id_idx' => array('profile_id'),
'blog_entry_created_idx' => array('created')
),
+ 'foreign keys' => array(
+ 'blog_entry_profile_id_fkey' => array('profile', array('profile_id' => 'id')),
+ ),
);
}
// Use user's preferences for short URLs, if possible
try {
- $user = $profile->getUser();
- $shortUrl = File_redirection::makeShort($url,
- empty($user) ? null : $user);
+ $user = $profile->isLocal()
+ ? $profile->getUser()
+ : null;
+ $shortUrl = File_redirection::makeShort($url, $user);
} catch (Exception $e) {
// Don't let this stop us.
$shortUrl = $url;
XMLStringer::estring('a', array('href' => $url,
'class' => 'blog-entry'),
_('More...'));
- $text = html_entity_decode(strip_tags($be->summary), ENT_QUOTES, 'UTF-8');
+ $text = common_strip_html($be->summary);
} else {
$options['rendered'] = $be->content;
- $text = html_entity_decode(strip_tags($be->content), ENT_QUOTES, 'UTF-8');
+ $text = common_strip_html($be->content);
}