Daizu
view release on metacpan or search on metacpan
lib/Daizu/Feed.pm view on Meta::CPAN
my $doc = XML::LibXML::Document->new('1.0', 'UTF-8');
my $feed;
my $entry_parent;
my $updated_elem;
if ($format eq 'atom') { # Atom 1.0
$feed = $doc->createElementNS($ATOM_NS, 'feed');
$entry_parent = $feed;
add_xml_elem($feed, title => $feed_title);
# TODO - description should be decoded from utf-8 at some point
add_xml_elem($feed, subtitle => $file->{description})
if defined $file->{description};
add_xml_elem($feed, id => $file->guid_uri);
add_xml_elem($feed, generator => 'Daizu CMS',
uri => 'http://www.daizucms.org/',
version => $Daizu::VERSION,
);
add_xml_elem($feed, link => undef,
rel => 'self',
href => $url,
lib/Daizu/File.pm view on Meta::CPAN
my ($self) = @_;
return parse_db_datetime($self->{modified_at});
}
=item $file-E<gt>property($name)
Return the value of the Subversion property C<$name> on this file, or
undef if there is no such property.
The value is assumed to be text, so leading and trailing whitespace is
trimmed off, and the value is decoded as UTF-8. If the value exists
but contains only whitespace then undef is returned.
=cut
sub property
{
my ($self, $name) = @_;
my $value = db_select($self->{db}, 'wc_property',
{ file_id => $self->{id}, name => $name },
'value',
lib/Daizu/File.pm view on Meta::CPAN
=item $file-E<gt>most_specific_property($name)
Return the value of the Subversion property C<$name> on this file, or on its
closest ancestor if it has no such property. Therefore properties on
subdirectories will override those of their parent directories. Returns
undef if there is no property of this name on the file or any of its
ancestors. Properties whose values are empty or contain only whitespace
are ignored.
The value is assumed to be text, so leading and trailing whitespace is
trimmed off, and the value is decoded as UTF-8.
=cut
sub most_specific_property
{
my ($file, $name) = @_;
while (defined $file) {
my $value = $file->property($name);
if (defined $value && $value =~ /\S/) {
lib/Daizu/File.pm view on Meta::CPAN
Return the value of the Subversion property C<$name> on this file, or on its
most distant ancestor if it has no such property. Therefore the return
value is the 'top level' value for this property. For example, if you ask
for the C<dc:title> property then you might get the title of the website
of which C<$file> is a part. Returns undef if there is no property of
this name on the file or any of its ancestors. Properties whose values are
empty or contain only whitespace are ignored.
The value is assumed to be text, so leading and trailing whitespace is
trimmed off, and the value is decoded as UTF-8.
=cut
sub least_specific_property
{
my ($file, $name) = @_;
my $best;
while (defined $file) {
my $value = $file->property($name);
lib/Daizu/File.pm view on Meta::CPAN
while (defined $file) {
$best = $file if defined $file->{custom_url};
$file = $file->parent;
}
return $best;
}
=item $file-E<gt>title
Return the title of C<$file>, as a decoded Perl text string, or undef
if the file doesn't have a title. The title is taken from the file's
C<dc:title> property.
=cut
sub title { shift->{title} }
=item $file-E<gt>short_title
Return the 'short-title' of C<$file>, as a decoded Perl text string, or undef
if the file doesn't have a title. The title is taken from the file's
C<dc:title> property.
=cut
sub short_title { shift->{short_title} }
=item $file-E<gt>description
Return the description/summary of C<$file>, as a decoded Perl text string,
or undef if the file doesn't have a description. The value is taken from
the file's C<dc:description> property.
=cut
sub description { shift->{description} }
=item $file-E<gt>generator
Create and return a generator object for the file C<$file>.
lib/Daizu/File.pm view on Meta::CPAN
The canonical tag name, as used as the primary key in the C<tag> table.
=item original_spelling
The spelling used for to name the tag in the C<daizu:tags> property of
this file.
=back
Both of these values are provided as text strings, decoded from UTF-8.
=cut
sub tags
{
my ($self) = @_;
my $sth = $self->{db}->prepare(q{
select t.tag, ft.original_spelling
from tag t
lib/Daizu/File.pm view on Meta::CPAN
Each one contains the following keys:
=over
=item id
The ID number of the entry in the database's C<person> table.
=item username
The username, as specified in the C<daizu:author> property, decoded
into a Perl text string. Always defined.
=item name
Full name of the author, as a Perl text string. Always defined.
=item email
Email address as a binary string, or undef.
lib/Daizu/Util.pm view on Meta::CPAN
$s = encode('UTF-8', $s, Encode::FB_CROAK);
$s =~ s{([^-.,/_a-zA-Z0-9 ])}{sprintf('%%%02X', ord $1)}ge;
$s =~ tr/ /+/;
return decode('UTF-8', $s, Encode::FB_CROAK);
}
=item url_decode($s)
If C<$s> is URL encoded, return a decoded version. The opposite
of L<url_encode()|/url_encode($s)>.
=cut
sub url_decode
{
my ($s) = @_;
$s = encode('UTF-8', $s, Encode::FB_CROAK);
$s =~ tr/+/ /;
( run in 0.635 second using v1.01-cache-2.11-cpan-26ccb49234f )